CSV

Nathan Ernst nathan.ernst at gmail.com
Wed Feb 22 19:39:11 EST 2017


One other thing besides the issues noted with filename - newline is set to
a space. It should be set to an empty string.

See: https://docs.python.org/3/library/csv.html#id3

Regards,
Nate

On Wed, Feb 22, 2017 at 3:52 PM, <breamoreboy at gmail.com> wrote:

> On Wednesday, February 22, 2017 at 5:55:47 PM UTC, Braxton Alfred wrote:
> > Why does this not run?  It is right out of the CSV file in the Standard
> Lib.
> >
> > Python ver 3.4.4, 64 bit.
> >
> > import csv
> > """ READ EXCEL FILE """
> > filename = 'c:\users\user\my documents\Braxton\Excel\personal\bp.csv'
> > with open (filename, newline = ' ') as bp:
> >     dialect = csv.excel
> >     reader = csv.reader(bp)
> >     for row in reader:
> >         print (row)
> >
> > Marc
>
> Of course it will run, assuming that there are no syntax errors.
>
> Besides that using raw strings or forward slashes will probably help.
>
> Of course we don't actually know as you haven't shown us the actual error
> that you get, and our crystal balls broke down long ago owing to over use.
>
> You might like to read http://www.catb.org/~esr/faqs/smart-questions.html
> and then http://sscce.org/ or even http://stackoverflow.com/help/mcve and
> then ask again.
>
> Kindest regards.
>
> Mark Lawrence.
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list