python path separator

Vlastimil Brom vlastimil.brom at gmail.com
Thu Sep 2 03:25:23 EDT 2010


2010/9/2 swapnil <swapnil.st at gmail.com>:
> I could not find any documentation for variables os.path.sep and
> os.path.altsep. Although the first is pretty straightforward can
> anyone explain the purpose of the second variable? Is it even useful?
> According to issue http://bugs.python.org/issue709428, os.path.altsep
> was 'None' till a long time and it didn't bother anyone?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
see
http://docs.python.org/library/os.html#os.sep
http://docs.python.org/library/os.html#os.altsep

On windows it returns a slash
>>> os.altsep
'/'
which is often easier to use (i.e. if I understand correctly, in most
usual cases the forward slash should probably just work on most of the
recent OSes).

   vbr



More information about the Python-list mailing list