Re: Construct raw strings?

2005-09-08 Thread Terry Reedy
Thomas W [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I got a stupid problem; on my WinXP-box I want to scan the filesystem and enter a path to scan like this : path_to_scan = 'd:\test_images' I believe you can always use / instead of \ for Win filenames from Python. Avoids

Re: Construct raw strings?

2005-09-08 Thread Benji York
Peter Hansen wrote: Benji York wrote: It's not join that's getting you, it's the non-raw string representation in path_to_scan. Use either 'd:\test_images' or 'd:\\test_images' instead. Benji, you're confusing things: you probably meant r'd:\test_images' in the above Doh! I did

Construct raw strings?

2005-09-07 Thread Thomas W
I got a stupid problem; on my WinXP-box I want to scan the filesystem and enter a path to scan like this : path_to_scan = 'd:\test_images' This is used in a larger context and joined like real_path_after_scanning = os.path.join(path_to_scan, somepart, 'foo', 'bar', filename) Using

Re: Construct raw strings?

2005-09-07 Thread Benji York
Thomas W wrote: I got a stupid problem; on my WinXP-box I want to scan the filesystem and enter a path to scan like this : path_to_scan = 'd:\test_images' Note the lack of an r prefix and the \t sequence above. The problem is that some of the parts being joined contains escape

Re: Construct raw strings?

2005-09-07 Thread Robert Kern
Thomas W wrote: I got a stupid problem; on my WinXP-box I want to scan the filesystem and enter a path to scan like this : path_to_scan = 'd:\test_images' path_to_scan = r'd:\test_images' This is used in a larger context and joined like real_path_after_scanning =

Re: Construct raw strings?

2005-09-07 Thread Peter Hansen
Benji York wrote: It's not join that's getting you, it's the non-raw string representation in path_to_scan. Use either 'd:\test_images' or 'd:\\test_images' instead. Benji, you're confusing things: you probably meant r'd:\test_images' in the above, but in any case I think Robert Kern's on