import json with open('tokenler.json', 'w') as file: file.write(json.dumps(mydict, ensure_ascii=False))