I have list and I want to enter each element of that list into associated indexed cells of a column in MYSQL using Python.
Eg
lst = [11,22,33,44,55,66]
MYSql column:
Data
11
22
33
44
55
66.
How can I achieve this.
Following code will do the work:
values = [list([item]) for item in lst]
cursor.executemany(u'INSERT INTO `tbl`(`Data`)(%s)', values)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.