Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- def prettyPrint(dct):
- print(json.dumps(dct, indent=4, sort_keys=True))
- if __name__ == "__main__":
- sample = {'name':'Jatin K Malik', 'age':25, 'id':1299, 'address':'Delhi, India', 'phone':9999999999, 'hobbies':'Code'}
- prettyPrint(sample)
- #####################
- #Output:
- #{
- # "address": "Delhi, India",
- # "age": 25,
- # "hobbies": "Code",
- # "id": 1299,
- # "name": "Jatin K Malik",
- # "phone": 9999999999
- #}
Add Comment
Please, Sign In to add comment