1>>> import json
2>>> print json.dumps({'a':2, 'b':{'x':3, 'y':{'t1': 4, 't2':5}}},
3... sort_keys=True, indent=4)
4{
5 "a": 2,
6 "b": {
7 "x": 3,
8 "y": {
9 "t1": 4,
10 "t2": 5
11 }
12 }
13}
14
1import pprint
2
3student_dict = {'Name': 'Tusar', 'Class': 'XII',
4 'Address': {'FLAT ':1308, 'BLOCK ':'A', 'LANE ':2, 'CITY ': 'HYD'}}
5
6print student_dict
7print "\n"
8print "***With Pretty Print***"
9print "-----------------------"
10pprint.pprint(student_dict,width=-1)
11