获取路径:
print os.path.abspath( __file__ )
print os.path.dirname( os.path.abspath( __file__ ) )print os.path.split(os.path.dirname( os.path.abspath( __file__ ) ))[0]
结果:
E:\pyworkspace\webpytest\test.py
E:\pyworkspace\webpytest
E:\pyworkspace