shutil module

Terry Reedy tjreedy at udel.edu
Mon Nov 18 10:42:13 EST 2002


"asdfasd asdfasdf" <s802645999 at yahoo.com> wrote in message
news:mailman.1037616151.30715.python-list at python.org...
> shutil.copy (glob.glob(r'c:\winnt\temp\events*'), r'c:\temp')

I think its's worth noting that forward slashes *do* work on Windows.
This is more portable, clearer both to read and check (since in Python
context one learns to see \x as one char), and more resilient (since
easily forgotten r not needed).

Unfortunately, glob or functions it calls will change the last slash
to a backslash.  (I obviously would prefer that it did not.)

> i checked the output of glob and it says
>
> >>> glob.glob(r'c:\winnt\temp\events-*')
> ['c:\\winnt\\temp\\events-18-Nov-2002.txt']
>
> could it be the double slash that is making the fault....??

This are no double slashes in the string itself (use len() to check).
They are merely doubled 'for your benefit' on the display.  So this is
not a possible reason.

Terry J. Reedy





More information about the Python-list mailing list