I want to convert a jupyter notebook to a clean python file.
I don't want the # In[ ]:
comments in the generated python script, I want it to be clean.
Is there any way to do that?
I ran below command jupyter nbconvert --to script --no-prompt notebook.ipynb
as mentioned in the comments of this answer but the generated script still contains # In[ ]:
comments.
Generated script:
#!/usr/bin/env python
# coding: utf-8
# In[1]:
print("Hello World")
# In[2]:
print("Hello Jupyter")
Desired script:
#!/usr/bin/env python
# coding: utf-8
print("Hello World")
print("Hello Jupyter")