how to create a .py file in jupyter notebook
时间: 2023-10-31 10:40:26 浏览: 167
How to create a donut chart like this in chart.js
To create a .py file in Jupyter Notebook, you can follow the following steps:
1. Open Jupyter Notebook and create a new Python notebook.
2. In the first cell, type or copy and paste the code you want to save as a .py file.
3. In the next cell, type the following command: `%%writefile myfile.py`
4. Replace `myfile.py` with the name you want to give your .py file.
5. Run the cell. This will create a .py file with the same name in the same directory where your notebook is stored.
6. You can now reuse this .py file in other Python projects by importing it.
阅读全文