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

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–课堂

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

python课堂笔记

 
iu不错哦的头像-北梦の博客iu不错哦1年前
0181

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-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-模板-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-课堂笔记-5.9

import re str1 = 'my naaaame is iu' #从开始位置去进行匹配 # print(re.match('my', str1).group(0)) # #search()是从整个字符串中查找和正则表达式匹配的字符串 # print(re.search('iu', str...
iu不错哦的头像-北梦の博客iu不错哦1年前
0151

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-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-课堂笔记(5.10)

import re #1.re.findall()函数:查找字符串中所有匹配的子串,返回值类型是列表,如果未匹配到,则返回一个空列表而不是none # str1='qwertyuioppoiu0516q' # a=re.findall('i',str1) # print(a...
iu不错哦的头像-北梦の博客iu不错哦1年前
0121