2011-05-03, 18:53
yeah you didn't use import re, i added the import for that.
tnx for the string hint.
cool, will be nice to have this in mainline.
not sure if my way for moving up directories is very pretty, but it works (and is very fast):
so then if a have a path that i want to move up 3 directories on, i do this:
thepath = self._updir(thepath, 3)
...there might be a better way to do this.
tnx for the string hint.
cool, will be nice to have this in mainline.
not sure if my way for moving up directories is very pretty, but it works (and is very fast):
PHP Code:
def _updir(self, thepath, x):
# move up x directories on thepath
while x > 0:
x -= 1
thepath = (os.path.split(thepath))[0]
return thepath
so then if a have a path that i want to move up 3 directories on, i do this:
thepath = self._updir(thepath, 3)
...there might be a better way to do this.