修改工作路径方便测试开发
1 2 3 4
| import os
path = r"C:\Users\Administrator\Documents\GitHub\BF-grading-range\\" os.chdir(path)
|
此外
例子二
1 2 3 4 5 6 7 8 9 10
| def chdir(): import os path = "../" os.chdir(path) a = os.getcwd() print(a) if __name__ == '__main__': chdir()
|
参考
https://www.runoob.com/python/os-chdir.html