[python] Opening a .ipynb.txt File

I have got downloaded a file that got downloaded in a format .pynb.txt extension. Can anyone help me to figure how to make it in a readable format? Attaching a screenshot of the file when i tried opening in python notebook.

Output of the python notebook when tried to open a file with extension .pynb.txt

This question is related to python

The answer is


These steps work for me:

  • Open the file in Jupyter Notebook.
  • Rename the file: Click File > Rename, change the name so that it ends with '.ipynb' behind, and click OK
  • Close the file.
  • From the Jupyter Notebook's directory tree, click the filename to open it.

I used to read jupiter nb files with this code:

import codecs
import json

f = codecs.open("JupFileName.ipynb", 'r')
source = f.read()

y = json.loads(source)
pySource = '##Python code from jpynb:\n'
for x in y['cells']:
     for x2 in x['source']:
         pySource = pySource + x2
         if x2[-1] != '\n':
            pySource = pySource + '\n'
print(pySource)

If you have a unix/linux system I'd just rename the file via command line

mv file_name.pynb.txt file_name.ipynb

worked like a charm for me!


go to cmd get into file directory and type jupyter notebook filename.ipynb in my case it open code editor and provide local host connection string copy that string and paste in any browser!done


Try the following steps:

  1. Download the file open it in the Juypter Notebook.
  2. Go to File -> Rename and remove the .txt extension from the end; so now the file name has just .ipynb extension.
  3. Now reopen it from the Juypter Notebook.

What you have on your hands is an IPython Notebook file. (Now renamed to Jupyter Notebook

you can open it using the command ipython notebook filename.ipynb from the directory it is downloaded on to.

If you are on a newer machine, open the file as jupyter notebook filename.ipynb.

do not forget to remove the .txt extension.

the file has a series of python code/statements and markdown text that you can run/inspect/save/share. read more about ipython notebook from the website.

if you do not have IPython installed, you can do

pip install ipython

or check out installation instructions at the ipython website


Below is the easiest way in case if Anaconda is already installed.

1) Under "Files", there is an option called,"Upload".

2) Click on "Upload" button and it asks for the path of the file and select the file and click on upload button present beside the file.