我是StackOverflow的新手,我使用的是python 3。 我在Python 3上运行Python 2。
if isinstance(text, str):
--> text = text.decode(options['inputEncoding'])
AttributeError:'str'对象没有属性'decode'
有谁知道这有什么不对,我试着到处查找?
这是默认选项:
defaultOptions = {
'inputEncoding' : 'utf-8', # default input encoding for strings
'outputEncoding' : 'utf-8', # default output encoding
'substituteChar' : '?', # use to substitute unrecognised characters
'handleUnrecognised' : UNRECOGNISED_FAIL, # unrecognised characters:
# fail, echo or substitute
'outputASCIIEncoded' : False, # HTML-encoded ASCII output?
}