排序
Python_24.6.7_mysql插入
import pymysql # 建立数据库连接 db = pymysql.connect(host='localhost', user='root', password='123456', db='stu') cursor = db.cursor() # 创建学生表的SQL语句(注释掉了,因为表如果已...
python-模板-6-11
import pymysql #1.创建学生表,插入两条数据 #数据库连接 conn=pymysql.connect(host='localhost',user='root',password='123456789',db='world') cursor=conn.cursor() # create_sql='''creat...
Python-pymysql建表
import pymysql zwy = pymysql.connect(host='localhost', user='root', password='123456789', db='world') cursor = zwy.cursor() create_sql = '''create table student ( sid char(10), sna...
Python-pymysql插入
import pymysql zwy = pymysql.connect(host='localhost', user='root', password='123456789', db='world') cursor = zwy.cursor() insert_many_sql = [('01', 'zwy', 'n'), ('02', 'yxj', 'n'...
Python-pymysql修改
import pymysql zwy = pymysql.connect(host='localhost', user='root', password='123456789', db='world') cursor = zwy.cursor() zwy.commit() update_sql = '''update student set sname = ...
Python-pymysql删除
import pymysql zwy = pymysql.connect(host='localhost', user='root', password='123456789', db='world') cursor = zwy.cursor() zwy.commit() delete_sql = 'delete from student where sna...
Python_模拟银行对接mysql_24.6.14
1.创建数据库和数据表 import pymysql CREATE_SCHEMA_SQL = 'CREATE SCHEMA bank' CREATE_TABLE_SQL = '''CREATE TABLE account( account_id varchar(20) not null, account_passwd char(6) not...
Python上课笔记
编写列表推导式1、将一组数字列表[1,2,3,4,5,6,7,8],每个数字都平方并除以2.l1 = [1, 2, 3, 4, 5, 6, 7, 8] print([i * i / 2 for i in l1])2、将一组字符串列表['apple','banana','cherry'],...
python_小作业_24.6.20
1.定义一个Box类,有width, height, depth三个属性,init()和get_Volume()(求体积)两个方法。其中init()方法用于获得初始化属性值,width, height, depth分别为5,6,7. (1)定义get_Volume()...
python_练习_mysql_24.6.6
import pymysql db = pymysql.connect( host='localhost', user='root', password='123456789', db='world' ) cursor = db.cursor() sql = '''CREATE TABLE zhangsan ( sno CHAR(10) PRIMARY KE...