[Tutor] File Import

Mitya Sirenef msirenef at lightbird.net
Thu Apr 4 15:25:19 CEST 2013


On 03/18/2013 11:14 PM, Clark, Tristan wrote:
> Hi,
>
> I am importing data produced from an external code. The data is 
> organized into columns. I would like to be able to assign each column 
> to a variable or array. How would you recommend doing this? I have 
> been looking into the pickle function, as well as "f.readline" and 
> "for line in f:" and I got all of those ideas from the Python 
> Tutorial. I am a little new to python.
>
> Thank you,
>
> Tristan Clark
>

Take a look at csv module (for Py2, see drop down version choice for Py3):

http://docs.python.org/2/library/csv.html

Is the data going to be ASCII? There are some issues in regard to csv / 
unicode
handling.   -m


-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/



More information about the Tutor mailing list