Name

load, loads

Synopsis

load(fileobj)
loads(str)

loads creates and returns the object v represented by string str, so that for any object v of a supported type, v ==loads(dumps( v )). If str is longer than dumps( v ), loads ignores the extra bytes. load reads the right number of bytes from file-like object fileobj and creates and returns the object v represented by those bytes. If two calls to dump are made in sequence on the same file, two later calls to load from that file deserialize the two objects that dump serialized. load and loads transparently support pickles performed in either binary or ASCII mode. If data is pickled in binary format, the file must be open in binary format for both dump and load. load( f ) is like Unpickler( f ).load( ).

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.