[python]获取当前路径用来构造相对路径的几种方法
print('getcwd', os.getcwd()) print('sysargv', sys.argv) print('realpath', os.path.realpath(sys.argv[0])) print('realpath.split', os.path.split(os.path.realpath(sys.argv[0]))[0]) print('__file__', __file__) print('__file__.dir', os.path.dirname(__file__))