How to save a file into a directory in Jupyter notebook?

后端 未结 3 1313
梦如初夏
梦如初夏 2021-02-20 01:43

I invoke \"jupyter notebook\" under:

 [abigail@localhost anaconda3]$ jupyter notebook

By default, it saves to the directory of anaconda3/ with

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 01:57

    There are two methods:
    1.You can use the magic command %notebook to save as ipynb

      %notebook "directory/to/file/filename.ipynb"     
    

    2.You can use the magic command %%writefile to save as py file

      %%writefile "directory/to/file/filename.py"
    

    In the second method, you should put this command at the top of the cell, otherwise it will throw an error.

提交回复
热议问题