What is Jupyter Notebook?
A Jupyter notebook is a web-based tool that lets us write, run and share live code, visualizations, and instructions among friends, students, and teachers. It's a powerful tool to interactively develop and present data science projects.
Open your Linux Terminal.
sudo apt-get -y install ipython ipython-notebook
Now you can install Jupyter notebook directly in the system or a better approach would be to use a virtual environment and then install it.
sudo -H pip install jupyter
Now go to any folder where you want to save your code, and run the command to start the Jupyter Notebook.
This will start the notebook server on the localhost 8888 port. A browser window will be opened and your files in the current directory will be listed there.
Click on the 'new' button in the top right corner and select Python3. It will open a new notebook.
Change the name of your notebook by clicking on the 'Untitled' text in the top left corner.
Now in the first blank cell, type your first python code, and hit the run button. The output will be printed at the bottom of the cell.
The cursor will move to the next cell.
You can always find this file in the folder you started the Jupyter notebook command.
You have the option to download the notebook in PDF, HTML, or .ipynb format.
To use a text file in any of your programs, place the text file in the directory where you started the notebook. Alternatively, you can upload the text file using the upload button on the home screen of the Jupyter notebook.
Here I have uploaded the 'wordcloud.txt' file using the 'upload' button in the top right corner. Now in the code example below I have used the wordcloud.txt file to open it and read its content.
You can read more about reading, writing to, copy, moving the file using python code.