Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这些变量:
s1 = '\xd1\x98\xd1\x83\xd0\xbd' s2 = u'\xd1\x98\xd1\x83\xd0\xbd'
如何将变量s2转换为相同,s1以便比较两者将返回True。
s2
s1
True
您可以转换s1为与以下内容相同s2:
s1 = '\xd1\x98\xd1\x83\xd0\xbd' s2 = u'\xd1\x98\xd1\x83\xd0\xbd' s1 = s1.decode('unicode-escape')