写一个工具方法往MySQL数据库里面插入10000条数据【杭州多测师_王sir】【杭州多测师】
这是用Python写的插入数据的脚本
import pymysql db = pymysql.connect(host="192.168.43.131", user="root", password="123456", database="test", port=3306) cur = db.cursor() def get_filename(): o = open('.\db_data.txt') f = o.readlines() for i in f: a = i.strip('\n') yield a r = get_filename() i = 0 while i<=3: cur.execute("create table student"+ str(r.__next__())+ "(id int(10) primary key,age int(20),name varchar(255))") i+=1
插入之后数据库里面的数据