【发布时间】:2013-05-06 20:47:42
【问题描述】:
我通过 cgitb 收到以下错误:
TypeError: must be str, not bytes
args = ('must be str, not bytes',)
with_traceback = <built-in method with_traceback of TypeError object>
单挑出来的代码行是:
pickle.dump(state, output_file)
输出文件打开到特定路径进行写入。
我认为我没有见过 Py3k 以新方式创建、编组和解组“hello world”字符串的“hello pickle”。任何人都愿意解释我需要对文件做哪些不同的处理(指定 UTF-8 编码或其他内容),并发布从 Py3k 的基本字符串编组和解组的“Hello world”?
【问题讨论】:
标签: python python-3.x marshalling pickle utf