Bug or feature? Slash in os and os.path

Christian Tismer tismer at appliedbiometrics.com
Wed May 19 11:30:04 EDT 1999


Hi all,

What is the desired behavior of os.listdir, os.path.listdir
and os.path.exists?

I wouldn't care if appending a slash is allowed or not,
but it should always be consistent.

>>> os.path.exists('D:/Back/RsServer/gm/xmls/gm/cicos/') # oops
0
>>> os.path.exists('D:/Back/RsServer/gm/xmls/gm/cicos') # ok
1
>>> os.path.isdir('D:/Back/RsServer/gm/xmls/gm/cicos/') # oops
0
>>> os.path.isdir('D:/Back/RsServer/gm/xmls/gm/cicos') # ok
1

>>> os.listdir('D:/Back/RsServer/gm/xmls/gm') # ok
['subsets', 'cicos', ...]

>>> os.listdir('D:/Back/RsServer/gm/xmls/gm/') # ok
['subsets', 'cicos', ...]
>>> 

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list