list dictionary to json file python with tab

Solutions on MaxInterview for list dictionary to json file python with tab by the best coders in the world

showing results for - "list dictionary to json file python with tab"
Pedro
30 Feb 2018
1import json
2with open('data.json', 'w') as f:
3    json.dump(data, f)
4On a modern system (i.e. Python 3 and UTF-8 support), you can write a nicer file with
5
6import json
7with open('data.json', 'w', encoding='utf-8') as f:
8    json.dump(data, f, ensure_ascii=False, indent=4)