猿问

如何设置当前工作目录?

如何在Python中设置当前工作目录?

慕妹3146593
浏览 276回答 4
4回答

慕丝7291255

也许这就是您要寻找的:import osos.chdir(default_path)

撒科打诨

import osprint os.getcwd()  # Prints the current working directory设置工作目录:os.chdir('c:\\Users\\uname\\desktop\\python')  # Provide the new path here

德玛西亚99

它工作的Mac也import ospath="/Users/HOME/Desktop/Addl Work/TimeSeries-Done"os.chdir(path)检查工作目录os.getcwd()
随时随地看视频慕课网APP

相关分类

Python
我要回答