Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a raw python file in jupyter notebook

I am new to Python. I start learning it with Jupyter notebook. It is very useful to test python code at the same time I can document what I've learned with markdown supported by Jupiter.

Until I started with module/package I noticed that every file ends with " notebook extension .ipynb. I understand that in order for Jupyter to have this good-looking visualization it has to store the file in some kind of format.

is there any solution to create a raw python file using Jupyter?

I am ok if I have to install other plugins to accomplish this.

like image 291
channa ly Avatar asked Oct 26 '16 06:10

channa ly


People also ask

How do I create a Python .py file?

Create a Python fileIn the Project tool window, select the project root (typically, it is the root node in the project tree), right-click it, and select File | New .... Select the option Python File from the context menu, and then type the new filename. PyCharm creates a new Python file and opens it for editing.

What is raw in Jupyter Notebook?

A raw cell is defined as content that should be included unmodified in nbconvert output. For example, this cell could include raw LaTeX for nbconvert to pdf via latex, or restructured text for use in Sphinx documentation. The notebook authoring environment does not render raw cells.

What is raw Nbconvert in Python?

The “Raw NBConvert” cell type can be used to render different code formats into HTML or LaTeX by Sphinx. This information is stored in the notebook metadata and converted appropriately.


2 Answers

Actually jupyter allows to create plain-text file:

Create a new text file

Create a Text Field

Save the text file with python extension

Save with python file extension

like image 196
channa ly Avatar answered Oct 22 '22 09:10

channa ly


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.

enter image description here

like image 36
Raj006 Avatar answered Oct 22 '22 09:10

Raj006