如何在 Jupyter Notebook 中更改工作目录? [英] How to change working directory in Jupyter Notebook?

查看:38
本文介绍了如何在 Jupyter Notebook 中更改工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Jupyter Notebook 中找不到可以更改工作目录的位置,因此无法使用 pd.read_csv 方法读取特定的 csv 文档.

I couldn't find a place for me to change the working directory in Jupyter Notebook, so I couldn't use the pd.read_csv method to read in a specific csv document.

有什么办法吗?仅供参考,我目前使用的是 Python3.5.1.

Is there any way to make it? FYI, I'm using Python3.5.1 currently.

谢谢!

推荐答案

运行 os.chdir(NEW_PATH) 将改变工作目录.

Running os.chdir(NEW_PATH) will change the working directory.

import os
os.getcwd()
Out[2]:
'/tmp'
In [3]:

os.chdir('/')
In [4]:


os.getcwd()
Out[4]:
'/'
In [ ]:

这篇关于如何在 Jupyter Notebook 中更改工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆