Add abspath()

This commit is contained in:
Guido van Rossum 1999-01-29 18:05:18 +00:00
parent 1804dc3c07
commit e294cf620a
4 changed files with 28 additions and 0 deletions

View file

@ -367,3 +367,10 @@ def normpath(path):
if not comps and not slashes:
comps.append('.')
return slashes + string.joinfields(comps, '/')
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)