Skip to content

Instantly share code, notes, and snippets.

@matthewbelisle-wf
Created March 7, 2013 23:20
Show Gist options
  • Save matthewbelisle-wf/5112785 to your computer and use it in GitHub Desktop.
Save matthewbelisle-wf/5112785 to your computer and use it in GitHub Desktop.
example JSON creation
#!/usr/bin/env python
import json
if __name__ == '__main__':
title = input('Title: ')
author_name = input('Author name: ')
num_pages = int(input('Number of pages: '))
dict_ = {
'title': title,
'author_name': author_name,
'num_pages': num_pages,
}
with open('output.json', 'w') as fhandle:
json.dump(dict_, fhandle)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment