Python 设定工作目录
import os # 获取当前工作目录 current_dir = os.getcwd() print(f"当前工作目录: {current_dir}") # 更改当前工作目录到指定路径 new_dir = "/path/to/your/directory" os.chdir(new_dir) # 验证是否已经切换到新目录 new_current_dir = os.getcwd() print(f"新的当前工作目录: {new_current_dir}")
人生苦短,慢慢潇洒。
nsyw.run