How do I change the working directory in Python?

前端 未结 14 1188
天涯浪人
天涯浪人 2020-11-22 01:59

cd is the shell command to change the working directory.

How do I change the current working directory in Python?

14条回答
  •  心在旅途
    2020-11-22 02:10

    If You would like to perform something like "cd.." option, just type:

    os.chdir("..")

    it is the same as in Windows cmd: cd.. Of course import os is neccessary (e.g type it as 1st line of your code)

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题