2020
10-24
10-24
python对 MySQL 数据库进行增删改查的脚本
#-*-coding:utf-8-*-importpymysqlimportxlrd#importcodecs#连接数据库conn=pymysql.connect(host='127.0.0.1',port=3306,user='root',passwd='',db='test_hvr',charset='utf8')cursor=conn.cursor()#查询数据库effect_row=cursor.execute("select*fromkkpb_accountwhereuser_name='18800000000'")row_1=cursor.fetchmany(10)print(row_1)forrowinrow_1:withopen('ha.xls','a')asf:f.write(...
继续阅读 >