I collected data in the form of list of lists and wrote the data into a text file. The data in the text file looks like
[[123231,2345,888754],[223467,85645]
Also you can use eval to achieve this, but the other solutions maybe better:
eval
# reading a list from a file f = open('data.txt', 'r') l = eval(f.read()) # storing a list to a file outf = open('out','w') outf.write(str(l))
Sometime using eval is a bad practice. For more information check this post.