diff --git a/convert.py b/convert.py new file mode 100644 index 0000000..6f22a73 --- /dev/null +++ b/convert.py @@ -0,0 +1,11 @@ +import nbformat +from nbconvert import PythonExporter + +with open('main.ipynb', "r", encoding="utf-8") as f: + notebook = nbformat.read(f, as_version = 4) + +exporter = PythonExporter() +python_code, _ = exporter.from_notebook_node(notebook) + +with open('main.py', "w", encoding="utf-8") as f: + f.write(python_code) \ No newline at end of file