What's the best way to convert py to ipynb in code? or How can I programmatically convert py to ipynb

14 Replies, 1497 Views

For a no-frills solution, this script might help:
```python
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell().run_cell(open("script.py").read())
```

Save the output as .ipynb. Not perfect, but gets you 80% there.

---

Messages In This Thread



Users browsing this thread: 1 Guest(s)