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
These steps work for me:
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:
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.
Source: Stackoverflow.com