create a raw python file in jupyter notebook
Another way of creating a python file and executing it from within Jupyter notebook cell is as below:
Actually jupyter allows to create plain-text file:
Create a new text file
Save the text file with python extension
If you created a jupyter notebook (.ipynb), and your goal is to create a python executable file (.py) from it, you can directly use the menu option from "File > Download as > Python (.py)" as shown below.