CSV

Irmen de Jong irmen.NOSPAM at xs4all.nl
Wed Feb 22 13:09:56 EST 2017


On 22-2-2017 18:26, Braxton Alfred wrote:
> Why does this not run?  It is right out of the CSV file in the Standard Lib.

What does "not run" mean.
We can't help if you are not telling us the exact error message you're getting (if any)


> filename = 'c:\users\user\my documents\Braxton\Excel\personal\bp.csv'

That being said, there's at least a problem with this line because you're not escaping
the backslashes. So the resulting filename string is not what you intended it to be (try
printing it to see what I mean).

Several solutions possible:
- switch to using forward slashes /  this works on windows too.
- use a raw string literal  r'.....'
- or escape the backslashes \\


Irmen




More information about the Python-list mailing list