os.chdir()命令给出FileNotFoundError:[Errno 2]没有这样的文件或目录:jupyter笔记本中的'C:\\ Users \

时间:2019-04-01 18:30:15

标签: python jupyter-notebook file-not-found chdir

我正在使用Jupyter笔记本,尝试将当前工作目录更改为我的系统目录,即'C:/ Users',但它给我一个错误:FileNotFoundError:[Errno 2]没有这样的文件或目录:'C: //用户。 但是,在IDLE中也可以正常工作。请帮忙。

这是在Jupyter笔记本中尝试的方式

```import os
cwd = os.getcwd()
files = os.listdir(cwd)
os.chdir("C://Users")
os.getcwd()

-----------------------------------------------------------
FileNotFoundError        Traceback (most recent call last)
<ipython-input-16-03f5279edef8> in <module>
      2 cwd = os.getcwd()
      3 files = os.listdir(cwd)
----> 4 os.chdir("C://Users")
      5 os.getcwd()

FileNotFoundError: [Errno 2] No such file or directory: 'C://Users'
```

0 个答案:

没有答案