CSV module, DictReader problem (bug?)
sjmachin at lexicon.net
Thu Nov 2 03:28:46 CET 2006
Tom Plunket wrote:
> John Machin wrote:
> > If you were to write 'c:\temp\book1.csv', it would blow up ... because
> > \t -> tab and \b -> backspace. Get into the habit of *always* using raw
> > strings r'C:\Temp\Book1.csv' for Windows file names (and re patterns).
> > You could use double backslashing 'C:\\Temp\\Book1.csv' but it's
> > uglier.
> ...alternatively you can just use 'unix slashes', e.g.
> 'c:/temp/book1.csv', since those work just fine 'cause the Windows
> APIs deal with them properly.
Not all APIs do the right thing. If you fire up the cmd.exe shell and
feed it slashes as path separators, it barfs. Example:
Invalid switch - "junk".
Hence the advice to use rawstrings with backslashes -- they work under
More information about the Python-list