Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have these variables:
s1 = '\xd1\x98\xd1\x83\xd0\xbd' s2 = u'\xd1\x98\xd1\x83\xd0\xbd'
How can I transform variable s2 to be same as s1 so that comparing both will return True.
s2
s1
True
s2.encode('windows-1251')
u'\u0458\u0443\u043d'
јун
You can convert s1 to be the same as s2:
s1 = '\xd1\x98\xd1\x83\xd0\xbd' s2 = u'\xd1\x98\xd1\x83\xd0\xbd' s1 = s1.decode('unicode-escape')
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
s2.encode('windows-1251')work?u'\u0458\u0443\u043d',јун.