1,首先写一条能运行成功插入SQL的语句
INSERT INTO sign_guest(realname,phone,email,sign,event_id)VALUES("jack",13800101100,"jack@mail.com",0,1)
2,通过python批量写如文本
f =open(‘guest.txt‘,‘w‘) for i in range(1,100): str_i = str(i) realname = ‘jack‘ + str_i phone = 1380090911 + i email = "jack" + str_i + "@mail.com" sql = ‘INSERT INTO sign_guest(realname,phone,sign,event_id) values ("‘+realname+‘",‘+str(phone)+‘,"‘+email+‘",0,1);‘ f.write(sql) f.write("\n") f.close()
3,将生成的语句粘贴到mysql客户端执行
4,按照此思路可以进行其他语句的批量执行。