How to take the dict into .txt file, when my keys are tuple?
When my keys are int, it can run successfully.
But when the keys are tuple, it fails.
dict = {(1, 1): 11, (2, 2): 22, (3, 3): 33, (4, 4): 44, (5, 5): 55, (6, 6): 66, (7, 7): 77, (8, 8): 88, (9, 9): 99}
import json
with open('dict.txt', 'w') as file:
file.write(json.dumps(dict))
TypeError: keys must be str, int, float, bool or None, not tuple