【发布时间】:2016-06-26 07:31:33
【问题描述】:
我想知道是否有办法解决这个错误。任何帮助将不胜感激!
TypeError: can't concat bytes to str
import marshal, imp
f=open('PYTHONSCRIPT','rb')
f.seek(28) # Skip the header, you have to know the header size beforehand
ob=marshal.load(f)
for i in range(0,len(ob)):
open(str(i)+'.pyc','wb').write(imp.get_magic() + '\0'*4 + marshal.dumps(ob[i]))
f.close()
open(str(i)+'.pyc','wb').write(imp.get_magic() + '\0'*4 + marshal.dumps(ob[i]))
【问题讨论】:
-
请提供完整的堆栈跟踪。
-
str和bytes类型不兼容。您必须转换其中之一。上述答案应该为您提供所需的信息和详细信息。 -
@Carpetsmoker 甚至没有,需要与
str+bytes有一些东西
标签: python python-3.x