On Sunday, 25 March 2012 18:21:23 UTC+8, Vincent Knight wrote: > > Hi all, > > I've had trouble with this for a while. > > If I write the following in to a notebook cell: > > ------ > import csv > > output=csv.writer(open('test.csv','wb')) > > data=[[1,2],[3,4],[5,6]] > > for r in data: > output.writerow(r) > > ----- >
Perhaps you should close() what what was open() ? I.e. o= open('test.csv','wb') output=csv.writer(o) # do the stuff.... o.close() > > and evaluate, a hyperlink appears entitled 'test.csv', if I open that csv > file it is empy. Checking the code in bash mode in sage (and python) does > however work (and create the required csv file). > > Am I missing something to do with the notebook? > > Thanks, > Vince > > PS I've tried this on the notebook running on my machine and sagenb as > well... > > -- > Dr Vincent Knight > Cardiff School of Mathematics > Senghennydd Road, > Cardiff > CF24 4AG > (+44) 29 2087 5548 > www.vincent-knight.com > @drvinceknight <http://twitter.com/#!/drvinceknight> > Skype: drvinceknight > > -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org