Converting notebook to .py script

I am using Jupyter Lab to create/test/validate my assignments.
Once completed, are there any advantages to converting the .ipynb to .py?
Any suggestions of a Jupyter Lab extension to perform this conversion.

TIA

No, you don’t need to convert your ipynb notebook to .py file.

Sorry , but I think you misunderstood my question.
I know that I don’t have to convert to a .py file, but was interested to know if it could be done.
In the back of mind is the thought that a notebook is quite a complicated interface , and maybe a simple GUI frontend to a Python app might be better for data input and result presentation.

I think you could just copy-paste all the cells with code and it should run the same way.
The only change you would have is to modify the cells where you display the value of the variable being the last line of code in such cell.

Also all code responsible for displaying any plot could become troublesome. In the best case all the plots would show as different windows, in the worst (if you/code uses the same plot over and over), only the last one would be visible.

1 Like