On Sep 11, 8:04 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
On Sep 11, 5:40 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
Hi,
I'm trying to implement a function which returns whether a path is a
subpath of another one (e.g. /a/b/c is a subpath of /a/b).
I wrote this function which
Hi,
I'm trying to implement a function which returns whether a path is a
subpath of another one (e.g. /a/b/c is a subpath of /a/b).
I wrote this function which apparently seems to work fine:
import os
def issubpath(path1, path2):
Return True if path1 is a sub path of path2.
if path1 ==
On Sep 11, 5:40 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
Hi,
I'm trying to implement a function which returns whether a path is a
subpath of another one (e.g. /a/b/c is a subpath of /a/b).
I wrote this function which apparently seems to work fine:
import os
def issubpath(path1,
Giampaolo Rodola' schrieb:
Hi,
I'm trying to implement a function which returns whether a path is a
subpath of another one (e.g. /a/b/c is a subpath of /a/b).
I wrote this function which apparently seems to work fine:
import os
def issubpath(path1, path2):
Return True if path1 is a sub
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):