我在桌面上创建了一个名为"headfirstpython"的文件夹,我需要将当前的工作目录更改为该文件夹及其内部的子文件夹。 我使用os.getcwd()获取当前文件夹,它给了我'C Python32'。 我使用os.chdir('../ headfirstpython / chapter3')来更改目录,但它告诉它无法找到路径
>>> import os
>>> os.getcwd()
'C:\\Python32'
>>> os.chdir('../headfirstpython/chapter 3')
Traceback (most recent call last):
File"", line 1, in
os.chdir('../headfirstpython/chapter 3')
WindowsError: [Error 3] The system cannot find the path specified: '../headfirstpython/chapter 3'
>>> os.chdir('../headfirstpython/chapter3')
Traceback (most recent call last):
File"", line 1, in
os.chdir('../headfirstpython/chapter3')
WindowsError: [Error 3] The system cannot find the path specified: '../headfirstpython/chapter3'