python脚本批量生成50000条插入数据的sql语句

 1 f = open("xx.txt",'w')
 2 for i in range(1,50001):
 3     str_i = str(i)
 4     realname = "lxs"+str_i
 5     phone = 13678101715 + i
 6     email = "lxs" + str_i +"@126.com"
 7     sql = 'insert into table_a (realname,phone,email,sign,event_id) values ("'+realname+'",' +str(phone)+ ',"'+email+'",0,1);'
 8     f.write(sql)
 9     f.write("
")
10 print('50000 success!')
11 f.close()
原文地址:https://www.cnblogs.com/lxs1314/p/7518474.html