How to open local file on Jupyter?

前端 未结 9 1730
星月不相逢
星月不相逢 2020-12-10 13:08

In[1]:

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

Out[1]:

FileNotFoundError                         Tr         


        
9条回答
  •  -上瘾入骨i
    2020-12-10 13:24

    I do not know if it's what you were looking for, but it sounds to me something like this.

    This is for linux (ubuntu) but maybe it also works on mac:

    If the file is a pdf called 'book.pdf' and is located in your downloads, then

    import subprocess
    
    path='/home/user/Downloads/book.pdf'
    subprocess.call(['evince', path])
    

    where evince is the program that open pdfs in ubuntu

提交回复
热议问题