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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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)