Strange os.path.exists() behaviour

Pierre Quentel quentel.pierre at
Wed Jul 6 21:50:43 CEST 2005

os.path.exists(path) returns True if "path" exists

But on Windows it also returns True for "path" followed by any number of 
dots :

Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.path.exists('Lib/')
True                # expected
 >>> os.path.exists('Lib/')
True                # unexpected
 >>> os.path.exists('Lib/')
True                # unexpected

Is there a reason for this ? Is there a test that returns True only for 
the really existing path ?


More information about the Python-list mailing list