老师,pickle.dumps(obj,protocol = -1),这里的-1,指的是什么?
来源:10-6 scrapy-redis源码剖析-dupefilter.py-
python小白菜
2018-03-12
我百度看的protocol是指协议版本,默认0是指存放到类文件里,>0是指二进制形式,那<0是指什么?
写回答
1回答
-
bobby
2018-03-13
def dumps(*args, **kwargs): # real signature unknown """ Return the pickled representation of the object as a bytes object. The optional *protocol* argument tells the pickler to use the given protocol; supported protocols are 0, 1, 2, 3 and 4. The default protocol is 3; a backward-incompatible protocol designed for Python 3. Specifying a negative protocol version selects the highest protocol version supported. The higher the protocol used, the more recent the version of Python needed to read the pickle produced. If *fix_imports* is True and *protocol* is less than 3, pickle will try to map the new Python 3 names to the old module names used in Python 2, so that the pickle data stream is readable with Python 2. """ pass
00
相似问题