[Tutor] Using if statement with csv file
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Jan 28 13:27:09 CET 2015
On 27/01/2015 22:40, dw wrote:
> Hi Tammy,
> I wonder how big your csv file is?
> I have ever read a small csv file into one variable.
> Even a csv file with 100 rows.
> And then split it into identified fields from there.
> I look at the csv file with Notepad++ to see if the data rows end with a
> \r or a \n.
> I then split that into a list and each row is an element in the list.
> I can then split each row by the comma delimiter, to resolve down to
> each field.
> Just an idea.
>
I let the csv DictReader described here
https://docs.python.org/3/library/csv.html#csv.DictReader do the work
for me.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list