在 python 中以 w+b 模式解酸洗

unpickling in w+b mode in python

我尝试使用 w+b 模式进行 unpickling。 我收到异常 EOFError: 运行 out of input。 为什么在 w+b 模式下无法进行 unpickling? w+b 模式还提供了读取二进制文件的权利,那么为什么我会得到这个异常以及运行 out of input 在这里意味着什么

正在 w+b will truncate the file 打开一个文件。如果你想打开一个文件进行读写而不截断,你应该使用r+b.