Python pickle: fix \r characters before loading

前端 未结 4 2147
予麋鹿
予麋鹿 2021-01-02 13:46

I got a pickled object (a list with a few numpy arrays in it) that was created on Windows and apparently saved to a file loaded as text, not in binary mode (ie. with

4条回答
  •  臣服心动
    2021-01-02 14:12

    Have you tried unpickling in text mode? That is,

    x = pickle.load(open(filename, 'r'))
    

    (On Windows, of course.)

提交回复
热议问题