UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode

详细解释见:UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode

简而言之,在python中对中文的匹配,如果采用Unicode编码:

u'Hello' == 'Hello'
True
u'Hello' == '\x81\x01'
main:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False

你可能感兴趣的:(UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode)