help I'm getting delimited

Paul Watson paul.hermeneutic at gmail.com
Tue Dec 16 11:38:56 EST 2008


On Tue, 2008-12-16 at 08:26 -0800, aka wrote:
> Hi, I'm going nuts over the csv.reader and UnicodeReader class.
> Somehow I can't get this method working which is supposed to read a
> csv file which name is inputted but here now hardcoded. What I need
> for now is that the string version of the list is put out for control.
> Later on I will only need to read the first column (id) of the csv
> file to be able to fill in a session var with a list of all ids.
> inp = c:/temp/test.csv
> roles = []
> try:
> fp = open(inp, 'rb')
> reader = csv.reader(fp)
> for r in reader:
>     rollen.append(r)
> except:
>     msg = "Er is iets mis met de UnicodeReader"
> 
> return dict(file=in,roles=str(roles))
> Any help greatly appreciated!
> Cheers

Did you intend inside the loop to write:

	roles.append(r)




More information about the Python-list mailing list