Advertisement
zrhans

json_demo.py

Jan 18th, 2020
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. ''' JavaScript Object Notation '''
  2. import json
  3.  
  4. with open('states.json') as f:
  5.   data = json.load(f)
  6.  
  7. for state in data['states']:
  8.   del state['area_codes']
  9.  
  10. with open('new_states.json', 'w') as f:
  11.   json.dump(data, f, indent=2)
  12.  
  13. '''https://github.com/zrhans/code_snippets/blob/master/Python-JSON/json_demo.py'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement