[Tutor] Extract from file
Monte Milanuk
memilanuk at gmail.com
Thu Jun 10 04:02:21 CEST 2010
Dave Kuhlman <dkuhlman <at> rexx.com> writes:
>
> Monte gave you a good suggestion *if* you are sure that there is no
> quoting and, especially, if you are sure that there are no commas
> inside of quotes in your input data.
>
> However, it seems that you are dealing with a CSV (comma separated
> values) file. Python has a module for that. See:
>
> http://docs.python.org/library/csv.html
>
> That module might help you write safer code.
>
Well, like I said... 'blind leading the blind'. I was piecing it together from
what I've been exposed to. I had a feeling there was a csv function out there
but not having any experience with it I stuck with what I had seen. Reading up
on the csv file reading function, it does appear to be a *much* better solution
for reading the file and processing the contents!
Monte
More information about the Tutor
mailing list