Skip to content

Instantly share code, notes, and snippets.

@perduta
Created June 27, 2016 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perduta/53e5cbee43ff5b370bd5c0752e955175 to your computer and use it in GitHub Desktop.
Save perduta/53e5cbee43ff5b370bd5c0752e955175 to your computer and use it in GitHub Desktop.
import os
import os.path
import json
with open('json') as f:
data = json.load(f)
if not os.path.exists(data['branch']):
os.mkdir(data['branch'])
for module_name, code in data['modules'].items():
path = os.path.join(data['branch'], '{}.js'.format(module_name))
with open(path, 'w') as f:
f.write(code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment