Difference between json.load() and json.loads() [From: RE: question about file handling with "with"]

ian douglas ian.douglas at iandouglas.com
Wed Mar 28 15:59:56 CEST 2012

On Mar 28, 2012 6:54 AM, "Nadir Sampaoli" <nadirsampaoli at gmail.com> wrote:
> Hello everyone (my first message in the mailing list),
>> > Is the following function correct?
>> Yes, though I'd use json.load(f) instead of json.loads().
> The docs aren't very clear (at least for me) about the difference between
json.load() and json.loads (and about "dump()" and "dumps()" too"). Could
you clarify it for me?

The functions with an s take string parameters. The others take file

foo = '{"age": 38}'
my_json = json.loads(foo)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120328/579eed35/attachment.html>

More information about the Python-list mailing list