我尝试使用http://grantcox.com.au/2012/01/decoding-b4u-binary-file-format/Python代码将.b4u文件导出为HTML格式,但由于某些原因,在程序点之后:
# find the initial caret position - this changes between files for some reason - search for the "Cards" string
for i in range(3):
addr = 104 + i*4
if ''.join(self.parser.read('sssss', addr)) == 'Cards':
caret = addr + 32
break
if caret is None:
return
我得到以下错误:
^{pr2}$我使用的Python版本是:python3.3.1(v3.3.1:d9893d13c6282013年4月6日,20:25:12)。在
你知道怎么解决这个问题吗?在
我已经在python2.7.4下运行了python3.3.2也给了我同样的错误。如果我知道如何将这段代码移植到python3.x.x一定会与unicode作为python3中字符串的默认值有关。 我想出了一个解决方案:
您只需使用这些方法,而不必使用原始作者提供的方法。 注意,如果您在任何地方看到unicode(),也应该将unicode()更改为str(),并将unichr()更改为chr()。还要记住print是一个函数,不能没有括号()就使用它。在
相关问题 更多 >
编程相关推荐