pythonjupyter-notebookipythonfile-conversion

converting from .py to .ipynb


I wrote a juypter notebook that has been converted to .py somehow. I would like it back in the original format. Does anyone know how to do that?

There is a previous stack overflow question about this, but the solution doesn't work for me. Converting to (not from) ipython Notebook format


Solution

  • The question was edited so this isn't as direct of an answer as it once was. Nevertheless, if you accidentally changed the extension of your Python notebook from .ipynb to .py as the OP did when originally asking the question, this is the answer for you.

    Just rename it changing the extension e.g. for linux/macos

    mv <file>.py <file>.ipynb
    

    or right-click rename for windows and type the full name with the extension

    (Since it seems that the contents are .ipynb contents already)