[Tutor] Converting a string into dictionary references
Joel Goldstick
joel.goldstick at gmail.com
Mon Apr 23 17:17:55 CEST 2012
On Mon, Apr 23, 2012 at 11:08 AM, Gerhardus Geldenhuis
<gerhardus.geldenhuis at gmail.com> wrote:
> Hi
> Here is my solution:
>
> def readcsvfile(filename,headerstring):
> headers = headerstring.split(',')
>
> f = open(filename, 'ro')
> csvdata = csv.DictReader(f)
> for row in csvdata:
> for column in headers[0:-1]:
> print row[column]+',',
> print row[headers[-1]]
>
> Regards
>
> On 23 April 2012 15:28, Gerhardus Geldenhuis
> <gerhardus.geldenhuis at gmail.com> wrote:
>>
>> Hi
>> Thanks for all the replies, I will try a the suggestions and post my
>> solution back.
>>
>> Regards
>>
>> --
>> Gerhardus Geldenhuis
>
>
>
>
> --
> Gerhardus Geldenhuis
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
nice!
--
Joel Goldstick
More information about the Tutor
mailing list