CSV

breamoreboy at gmail.com breamoreboy at gmail.com
Wed Feb 22 16:52:29 EST 2017


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.



More information about the Python-list mailing list