[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-06 Thread Marshall Hampton
Sometimes its convenient to use the DATA directory, which will be packaged with the worksheet if you save it (as a .sws file). So for example you could copy the file to the DATA directory doing something like: os.system('cp /full/path/to/list2.txt ' + DATA + 'list2.txt') and then f =

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-06 Thread Marshall Hampton
Thanks Jason, I'm surprised this never showed up on my radar before. -Marshall On Feb 6, 12:45 pm, Jason Grout jason-s...@creativetrax.com wrote: Marshall Hampton wrote: Sometimes its convenient to use the DATA directory, which will be packaged with the worksheet if you save it (as a .sws

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-06 Thread Jason Grout
Marshall Hampton wrote: Sometimes its convenient to use the DATA directory, which will be packaged with the worksheet if you save it (as a .sws file). So for example you could copy the file to the DATA directory doing something like: os.system('cp /full/path/to/list2.txt ' + DATA +

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-05 Thread David Joyner
Possibly I'm not understanding your English. Python can read in any text file, for example csv. So, the answer to your question seems to be in the thread you cited. Also, if you want to know which directory Sageroot is, type SAGE_ROOT. For example: sage: SAGE_ROOT

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-05 Thread Fall In Love with Sage
Thank you for your response! The problem is now in the following codes: 1. f = open(list2.txt) l1 = f.readline() ls1 = l1.split( ) l1 gives: Traceback (click to the left for traceback) ... IOError: [Errno 2] No such file or directory: 'list2.txt' Similarly, the eval

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-05 Thread David Joyner
On Thu, Feb 5, 2009 at 2:48 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: Thank you for your response! The problem is now in the following codes: 1. f = open(list2.txt) l1 = f.readline() ls1 = l1.split( ) l1 gives: Traceback (click to the left for traceback) ...

[sage-support] Re: How can you read a .txt/csv file in Sage?

2009-02-05 Thread Fall In Love with Sage
Thank you! It works now :) On Feb 5, 9:54 pm, David Joyner wdjoy...@gmail.com wrote: On Thu, Feb 5, 2009 at 2:48 PM, Fall In Love with Sage cs.losi...@gmail.com wrote: Thank you for your response! The problem is now in the following codes: 1.   f = open(list2.txt)   l1 =