ium_464979/jupyter_exporter.py
AWieczarek 0af0bea801 IUM_04
2024-04-02 22:12:47 +02:00

14 lines
348 B
Python

input_file = 'IUM_02.ipynb'
output_file = 'IUM_02.py'
import nbformat
from nbconvert import PythonExporter
with open(input_file, 'r', encoding='utf-8') as f:
nb = nbformat.read(f, as_version=4)
exporter = PythonExporter()
source, meta = exporter.from_notebook_node(nb)
with open(output_file, 'w', encoding='utf-8') as f:
f.write(source)