查(select * from 表名) 基本语法: select <字段1,字段2,...> from <表名> where <表达式>; 例如,查询student表中所有的记录,在终端窗口输入命令: select id,name,age from employee; 也可以查询限定的记录,输入如下命令,可以限定查询结果为第0条到第1条记录,也就是返回第一条记录: select * from empolyee limit 0,3; 也可以查询通过年龄限制查询 selec…
Python的列表就像是一个数组: 一.创建列表 movies=["The Holy Grail","Then Life of Brian","The Meaning of Life"] 这里的movies是一个变量,而且不需要声明变量的类型. 数组是从0开始计数的.如果要访问列表里的数据,可以这样: ['The Holy Grail', 'Then Life of Brian', 'The Meaning of Life'] >>&…
Django框架中的urls配置: 首先通过pycharm创建一个Django项目: 例如要写blog的功能:则在digango_lesson中的urls代码如下: """django_lesson URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics…
字典使用时,使用for k,v in items():要将字典转换为元组,因此效率较低,如果数据量较大,就不建议使用这样的形式获取key和value的值,而要使用 for item in dict: print(item[k])的形式. 格式化输出小技巧:print('product list'.center(50,'-'))作用是将product list打印居中,两边以'-'分隔开来.…