Hi, > This function would take two paths: A and B and give > the relation between them. Here are a few of examples. > > os.path.diff("/A/C/D/", "/A/D/F/") > ==> "../../D/F" > > os.path.diff("/A/", "/A/B/C/") > ==> "B/C" > > os.path.diff("/A/B/C/", "/A/") > ==> "../.." I'm not sure whether something like this is generally non-trivial. Suppose you have the following directory structure: /home -> usr/home /usr /usr/home What does os.path.diff("/home/", "/usr/") yield? "../usr/", I would presume? But that's obviously wrong: >>> import os >>> os.stat("/home/../usr") Traceback (most recent call last): File "<stdin>", line 1, in ? OSError: [Errno 2] No such file or directory: '/home/../usr' I've not thought about this long enough to say if there's a trivial solution to this, though :) Bye, Matthias A. Benkard ________________________________________________________________________ Matthias Andreas Benkard, Anarchokommunist und Pythonprogrammierer Persönliche Website: http://www.mulk.de.vu/ Persönlicher Weblog: http://www.kompottkin.de.vu/ Flames bitte nach /dev/null schicken. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20050918/a18b46b3/attachment.pgp
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4