by ben336 · 10y ago · 0 comments
Non obvious "magic" code like that tends to be frowned on in general, and especially in the python community
import json
with open("foo.json") as f:
foo = json.load(f)
For strings: import json
bar = '{"foo": "bar"}'
foo = json.loads(bar)As for whether or not json-sempai does, I looked through the code and I am pretty sure the answer is yes.
Declaring pkg_resources is probably a better way to include static data files in your package but hey radical freedom and all that.