Python 第2页
上课笔记以及平时作业记录

python-pymysql

import pymysql #需求:在world数据库中,创建一张student表 #1.连接数据库 db=pymysql.connect(host='localhost',user='root',passwd='123456789',db='world') #创建一个游标对象 cursor=db.cu...
iu不错哦的头像-北梦の博客iu不错哦1年前
0131

python–课堂

import re #1.正则表达式的两种定义方法 #(1)字符串方法: #匹配小写字母任意次 pattern = '[a-z]*'#正则表达式 print(re.match(pattern,'he123llo123'))#匹配0到第5个字符 print(re.match(pa...
iu不错哦的头像-北梦の博客iu不错哦1年前
0181

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...
iu不错哦的头像-北梦の博客iu不错哦1年前
0161

Python_24.6.7_mysql插入

import pymysql # 建立数据库连接 db = pymysql.connect(host='localhost', user='root', password='123456', db='stu') cursor = db.cursor() # 创建学生表的SQL语句(注释掉了,因为表如果已...
北梦的头像-北梦の博客SVIP北梦1年前
0321

python-模板-6-11

import pymysql #1.创建学生表,插入两条数据 #数据库连接 conn=pymysql.connect(host='localhost',user='root',password='123456789',db='world') cursor=conn.cursor() # create_sql='''creat...
iu不错哦的头像-北梦の博客iu不错哦12个月前
0151

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...
珊瑚海的头像-北梦の博客珊瑚海12个月前
0181

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'...
珊瑚海的头像-北梦の博客珊瑚海12个月前
0131

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 = ...
珊瑚海的头像-北梦の博客珊瑚海12个月前
0171

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...
珊瑚海的头像-北梦の博客珊瑚海12个月前
0271

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...
北梦的头像-北梦の博客SVIP北梦12个月前
0441