Python pickle.dump()保存乱码

资料:

http://www.cnblogs.com/pzxbc/archive/2012/03/18/2404715.html

http://bbs.chinaunix.net/thread-4192876-1-1.html

方法

pickle.dump(obj, file, [,protocol])
def fun2(file_name, mylist):
    file = open(file_name, 'wb')
    pickle.dump(mylist, file, 0)
    file.close()

为了避免保存的file乱码,在dump()里加上第三个参数,设为0(ASCII协议).

你可能感兴趣的:(python)