Diez B. Roggisch wrote:

Any reason why

os.path.normpath(a).startswith(os.normpath(b)) doesn't do the trick?

Except for the trivial type, you mean? That depends on whether "c:\foo" should be seen as a subpath to "c:\foobar" or not. I'd probably go for (also untested):

def issubpath(a, b):
    def fixpath(p):
        return os.path.normpath(p) + os.sep
    return fixpath(a).startswith(fixpath(b))

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to