我正在try 使用一个名为bidi的Python包.在这个包(algorithm.py)的一个模块中,有几行代码给出了错误信息,尽管它是包的一部分.
以下是台词:
# utf-8 ? we need unicode
if isinstance(unicode_or_str, unicode):
text = unicode_or_str
decoded = False
else:
text = unicode_or_str.decode(encoding)
decoded = True
下面是错误消息:
Traceback (most recent call last):
File "<pyshell#25>", line 1, in <module>
bidi_text = get_display(reshaped_text)
File "C:\Python33\lib\site-packages\python_bidi-0.3.4-py3.3.egg\bidi\algorithm.py", line 602, in get_display
if isinstance(unicode_or_str, unicode):
NameError: global name 'unicode' is not defined
我应该如何重新编写这部分代码,使其在Python3中工作?