[Python-ideas] Add pathlib.Path.write_json and pathlib.Path.read_json
Paul Moore
p.f.moore at gmail.com
Mon Mar 27 10:59:54 EDT 2017
On 27 March 2017 at 15:40, Ram Rachum <ram at rachum.com> wrote:
> Another idea: Maybe make json.load and json.dump support Path objects?
If they currently supported filenames, I'd say that's a reasonable
extension. Given that they don't, it still seems like more effort than
it's worth to save a few characters
with path.open('w'): json.dump(obj, f)
with path.open() as f: obj = json.load(f)
Paul
More information about the Python-ideas
mailing list