convert json ipython notebook(.ipynb) to .py file

后端 未结 10 2201
灰色年华
灰色年华 2020-12-02 12:28

How do you convert an IPython notebook file (json with .ipynb extension) into a regular .py module?

10条回答
  •  渐次进展
    2020-12-02 12:42

    Copy all the (''.ipynb) files in the Desired folder then execute:

    import os    
    
    desired_path = 'C:\\Users\\Docs\\Ipynb Covertor'
    
    os.chdir(desired_path)
    
    list_of_directory = os.listdir(desired_path)
    
    for file in list_of_directory:
            os.system('ipython nbconvert --to script ' + str(file))
    

提交回复
热议问题