On Friday, June 22, 2012 7:53:04 AM UTC-7, Dan Aldrich wrote:
>
> Trying to read in a .csv file into sagenb.
>
> data = list(csv.reader(file('C:/Documents and Settings/Dan/My
> Documents/Lab6.csv')))
>
> Then I thought about using a file dialog instead:
>
> import csv
> import tkFileDialog
> filename = tkFileDialog.askopenfilename()
> csvfile = open(filename, "rb")
>
> But that didn't work either. Any suggestions?
>
What didn't work? I used a command like
data = list(csv.reader(open('/path/to/BP.csv', 'rb')))
and got a message "_csv.Error: new-line character seen in unquoted field -
do you need to open the file in universal-newline mode?" (probably because
of how I created the csv file), so then I tried
data = list(csv.reader(open('/path/to/BP.csv', 'rU')))
which worked just fine.
--
John
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org