John Machin wrote: > 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: > C:\junk>dir c:/junk/*.bar > Invalid switch - "junk". > Hence the advice to use rawstrings with backslashes -- they work under > all circumstances. > The command shell is not an API.
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list