I have list and I want to enter each element of that list into associated indexed cells of a column in MYSQL using Python.
E.g
lst = [11,22,33,44,55,66]
MYSql column:
Data
11
22
33
44
55
66.
How can I achieve this.
I have list and I want to enter each element of that list into associated indexed cells of a column in MYSQL using Python.
E.g
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)