Viewing a Jupyter notebook file in a text editor

Jupyter notebooks are stored in JSON format. JSON is a human-readable text format that's used in many data exchange situations. It is highly portable across operating systems and can be transmitted using standard web protocols since as it is text. We can see the JSON by opening the following First JupyterLab.ipynb file in our text editor:

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dan is 37 years old. "
]
}
],
"source": [
"name = "Dan" ",
"age = 37 ",
"print(name + ' is ' + str(age) + ' years old.')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

The source and output of the code cell is stored in the order that it is entered. Also, the JSON contains several metadata or descriptive elements, such as the version of Python and Jupyter notebooks that are used to create our notebook file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset