So I am working on a project in which I build an ongoing dictionary for kennings (its for a norse mythology course). The problem I run into is on occasion a kenning has an apostrophe in it. For example the kenning "wolf’s joint" which has the definition "joint" gets written to the dictionary as {"wolf’s wrist": ‘joint’}, this would be fine if the json.loads() function didn’t through up an error because the key has "" and the value has ”. I was wondering if there is a way to force a dict to be written always with the "" instead of ”.
>Solution :
You can try json.dumps:
>>> print(json.dumps({"wolf's wrist": 'joint'}))
{"wolf's wrist": "joint"}