├── README.md └── zeppelin_to_script.py /README.md: -------------------------------------------------------------------------------- 1 | # zeppelin_notebook_to_script 2 | Converting a zeppelin notebook in single programming language to respective script 3 | 4 | ### Execution command 5 | python zeppelin_to_script.py input_file_name output_file_name 6 | 7 | output_file_name - can have the required extension. 8 | -------------------------------------------------------------------------------- /zeppelin_to_script.py: -------------------------------------------------------------------------------- 1 | import sys 2 | input_file_name = sys.argv[1] 3 | output_file_name = sys.argv[2] 4 | 5 | import json 6 | import codecs 7 | notebook = json.load(codecs.open(input_file_name, 'r', 'utf-8-sig')) 8 | 9 | script = [] 10 | for i in notebook["paragraphs"]: 11 | if "text" in i: 12 | para = i["text"].splitlines()[1:] 13 | if len(para) > 0: 14 | para = '\n'.join(para) 15 | script.append(para) 16 | script_f = '\n\n'.join(script) 17 | 18 | with open(output_file_name, 'w') as the_file: 19 | the_file.write(script_f) 20 | --------------------------------------------------------------------------------