How to get the absolute path
Get the absolute path
os.path.abspath(path)
returns a string
version of the absolute path of the path specified.
import os
print os.path.abspath(".")
print os.path.abspath("..")
os.chdir(path) changes the current working directory.
# from w w w . ja va 2s. co m
import os
os.chdir("/test")
print os.path.abspath(".")