Suppose I have lists within a list. I want it to insert list item in database.
[['1', '2', '3'], ['0.2', '2.3', '4'], ['5.4', '2', '3']]
here you will see that the main list has three sub-list. I want 1,0.2,5.4 in first-column of database, 2,2.3,2 in second-column of database and 3,4,3 in third column of database. some portion of code is given:
FILE_NAME = "mmd.txt"
list=[]
with open(FILE_NAME, 'r') as f:
lines = f.read().split('\n');
for line in lines:
list.append(line.split(','))
print list
for i in list:
print i
for j in i:
print j
print 'new line'
I can separate sub-list from list and I am also able to separate item from sub-list but how can I insert them into my database respectively? Please put your comment/suggestion.