| 1 | initial version |
a. Try a csv file. You can read and write as follows
writing:
with open('yourfile.csv', 'w') as f1:
writefile = csv.writer(f1)
writefile.writerows(data_list)
reading:
import csv
with open('your file.csv','rU') as f1:
data=list( csv.reader(f1) )
b. saving a more complex data format
Try using save and load.
save(data,'myfile')
result=load('myfile')
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.