1 | initial version |
Here is one collection of some simple python code.
To read a data file, the file is stored with the Sage notebook in a directory labelled DATA by Sage.
import csv
data =list( csv.reader(open(DATA+'infile.csv','rU')) )
The data is then in a list that you can manipulate.
Some code for writing a list named info
that contains lists is:
writefile = csv.writer(open(DATA+'outfile.csv', 'w'))
for i in range(0,len(info)):
writefile.writerow(info[i])