On 21/05/2015 15:14, Grant Edwards wrote: > On 2015-05-21, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > >> import glob >> print(glob.glob("c:/abc/def/ghjmain/features/XYZ/*<filename>")) >> >> Don't use backslashes \ as they have special meaning to Python. Use forward >> slashes and let Python convert them as needed. > > Interesting. I've never heard about this. > > When will Python convert them? >
It doesn't: Python passes them on unchanged and Windows accepts them in all but a few cases. (Although if any stdlib function were to call, eg, os.path.abspath on a path before passing it along to Windows then one effect is that the path is "normalised", ending up with backslashes. So perhaps that does happen in modules like shutil. Not sure). TJG -- https://mail.python.org/mailman/listinfo/python-list