path.startswith(dir)?

Daniel Dittmar daniel at dittmar.net
Sun May 12 14:30:37 EDT 2002


 > Ah... Perhaps os.path.commonprefix is better after all...

I'm afraid not:
 >>> f1 = 'h:\\perforce\\somefile1'
 >>> f2 = 'H:\\Perforce\\somefile2'
 >>> os.path.commonprefix ([f1, f2])
''

So you'll still have to do the normalizing yourself.

Daniel




More information about the Python-list mailing list