如何在 Jupyter 上打开本地文件? [英] How to open local file on Jupyter?

查看:173
本文介绍了如何在 Jupyter 上打开本地文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入[1]:

path='/Users/apple/Downloads/train.csv'
open(path).readline()

输出[1]:

FileNotFoundError                         Traceback (most recent call 
last)
<ipython-input-7-7fad5faebc9b> in <module>()
----> 1 open(path).readline()

FileNotFoundError: [Errno 2] No such file or directory: 
'/Users/apple/Downloads/train.csv'

我很困惑.我认为这段代码与许多教程完全相似,而且我确定我在正确的路径下有这个文件,但为什么它不起作用?

I'm confused a lot.I thought this code is exactly similar with many tutorials, and I'm sure I have this file in the right path, but why does it not works?

推荐答案

很多教程都说我们应该改变 Jupyter 的工作流程,但我没有明白.

Many tutorials said that we should change Jupyter's workflow, but I didn't get it.

最后,我找到了一个简单的方法:只需将文件拖到这一部分即可.

Finally, I find an easy way: Just drags file to this part.

这篇关于如何在 Jupyter 上打开本地文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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