排序
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.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-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-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() 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() create_sql = '''create table student ( sid char(10), sna...
python-模板-6-11
import pymysql #1.创建学生表,插入两条数据 #数据库连接 conn=pymysql.connect(host='localhost',user='root',password='123456789',db='world') cursor=conn.cursor() # create_sql='''creat...
Python_24.6.7_mysql插入
import pymysql # 建立数据库连接 db = pymysql.connect(host='localhost', user='root', password='123456', db='stu') cursor = db.cursor() # 创建学生表的SQL语句(注释掉了,因为表如果已...
python-6.7
import pymysql db=pymysql.connect(host='localhost',user='root',password='root',db='mysql') cursor=db.cursor() # sql='''create table student(sno char(10),sname varchar(20),primary k...
python作业加注释6月6日
import pymysql my = pymysql.connect( host='127.0.0.1', user='root', password='123456789', db='world' ) cur = my.cursor() cur.execute('DROP TABLE IF EXISTS minyan;') sql = '''create...