Rémi Lapeyre <[email protected]> added the comment:
Hi, using a file object is very common as it makes it possible to use something
that is not a file, like an HTTP request or something already in memory. It
makes the module serializing / de-serializing the data completely agnostic with
regard to the actual physical storage which has some advantages, for example it
will not raise FileNotFound.
If you want a oneliner to load data you already can use:
with open(filepath) as f: data = json.load(f)
----------
nosy: +remi.lapeyre
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41284>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com