[Tutor] Converting a string into dictionary references
Gerhardus Geldenhuis
gerhardus.geldenhuis at gmail.com
Mon Apr 23 17:08:28 CEST 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120423/ac733713/attachment.html>
More information about the Tutor
mailing list