import os 
curDir = os.getcwd()

 

 

最近使用Python 写了很多脚本,想导入脚本,发现不知道如何查看python 的默认工作目录,并修改默认工作目录。

方法/步骤

  1.  

    查看默认工作路径的命令:

    import os

    os.getcwd()

    python 如何查看与更换工作目录?
  2. 2

    修改工作路径的命令是(注意路径要用\\):

    os.chdir("d:\\目录")

    python 如何查看与更换工作目录?
     
posted on 2016-03-04 09:09  qqhfeng16  阅读(2911)  评论(0编辑  收藏  举报