from pymysql import connect
def main():
? ? #創(chuàng)建Connection連接
? ? conn = connect(host = 'localhost',port = 3306,user = 'root' ,password = 'hezhuang',database = 'TCL',charset = 'utf8')
? ? #? 獲得Cursor對象
? ? cursor = conn.cursor()
? ? #插入十萬條數(shù)據(jù)
? ? for? i? in range(100000):
? ? ? ? corsor.execute("insert into text_index values('ha-%d')"%i)
? ? #提交數(shù)據(jù)
? ? conn.commit()
if __name__ == '__main__':
? ? main()