[Tutor] Reading List from File

Monika Jisswel monjissvel at googlemail.com
Thu Jul 31 18:15:48 CEST 2008

Emile is right, in python you can do most of the stuff yourself by hand
coding it, or you can use pre-made bullet proof and ready to go modules,
here you can go for the csv module that comes part of the standard library.

import csv
myfile = open('file', 'r')  # open file for reading
data = csv.Reader(myfile, delimeter = ',') # let csv module load it
print data

2008/7/31 Emile van Sebille <emile at fenx.com>

> S Python wrote:
>> Hi Everyone,
>>  I am trying to read a comma-delimitted list ("aaa","bbb","ccc")
> In this case, the standard library provides csv for parsing comma separated
> files.  It's not the same as rolling your own, but it is made specifically
> for this use case...
> Emile
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080731/3efbb3dc/attachment.htm>

More information about the Tutor mailing list