import os
print os.getcwd()
或者
print os.path.abspath(os.curdir)
print os.path.abspath('.')
如果需要上一级路径,则:
print os.path.abspath('..')
上上级路径:
print os.path.abspath('..\..')
上上上级路径:
print os.path.abspath('..\..\..')
import os
print os.getcwd()
或者
print os.path.abspath(os.curdir)
print os.path.abspath('.')
如果需要上一级路径,则:
print os.path.abspath('..')
上上级路径:
print os.path.abspath('..\..')
上上上级路径:
print os.path.abspath('..\..\..')