Python pickle error: UnicodeDecodeError

吃可爱长大的小学妹 提交于 2019-11-30 07:47:50

By choosing to open the file in mode wb, you are choosing to write in raw binary. There is no character encoding being applied.

Thus to read this file, you should simply open in mode rb.

I think you should open the file as

f = open('sample_classifier.pickle', 'rb')
cl = pickle.load(f)   

You shouldn't have to decode it. pickle.load will give you an exact copy of whatever it is you saved. At this point you, should be able to work with cl as if you just created it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!