in later python releasesthe pickler introduced the notion of protocols--storage formats for pickled data specify the desired protocol by passing an extra parameter to the pickling calls (but not to unpickling callsthe protocol is automatically determined from the pickled data)pickle dump(objectfileprotocolor protocol= keyword argument pickled data may be created in either text or binary protocolsthe binary protocolsformat is more efficientbut it cannot be readily understood if inspected by defaultthe storage protocol in python is -only binary bytes format (also known as protocol in text mode (protocol )the pickled data is printable ascii textwhich can be read by humans (it' essentially instructions for stack machine)but it is still bytes object in python the alternative protocols (protocols and create the pickled data in binary format as well for all protocolspickled data is bytes object in xnot strand therefore implies binary-mode reads and writes when stored in flat files (see if you've forgotten whysimilarlywe must use bytes-oriented object when forging the file object' interfaceimport iopickle pickle dumps([ ] '\ \ ] \ ( \ \ \ pickle dumps([ ]protocol= '(lp \nl \nal \nal \na default=binary protocol ascii format protocol pickle dump([ ]open('temp','wb')same if protocol= ascii pickle dump([ ]open('temp',' ')must use 'rbto read too typeerrormust be strnot bytes pickle dump([ ]open('temp',' ')protocol= typeerrormust be strnot bytes io bytesio(pickle dump([ ]bb getvalue( '\ \ ] \ ( \ \ \ use bytes streams/buffers io bytesio(pickle dump([ ]bprotocol= getvalue( '(lp \nl \nal \nal \na also bytes for ascii io stringio(it' not str anymore pickle dump([ ]ssame if protocol= ascii typeerrorstring argument expectedgot 'bytespickle dump([ ]sprotocol= typeerrorstring argument expectedgot 'bytes databases and persistence