Skip to content

Instantly share code, notes, and snippets.

@Cheejyg
Created September 1, 2019 06:36
Show Gist options
  • Save Cheejyg/c4e2d41edee0edb00cd0a4ddbb2ca30c to your computer and use it in GitHub Desktop.
Save Cheejyg/c4e2d41edee0edb00cd0a4ddbb2ca30c to your computer and use it in GitHub Desktop.
import json
inputFilename = input("File: ")
with open(inputFilename, "rt") as input_file:
inputs = json.load(input_file)
source = ""
for x in range(len(inputs["cells"])):
for string in inputs["cells"][x]["source"]:
source += string
source += "\n\n"
with open(inputFilename.replace(".ipynb", ".py"), "wt") as output_file:
output_file.write(source)
output_file.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment