This works
s = 'jiā'
s.find(u'\u0101')
How do I do something like this:
s = 'jiā'
zzz = '\u0101'
s.find(zzz)
Since I’m using a variable now, how do I indicate the string represented by the variable is Unicode?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By defining it as a Unicode string in the first place.
Or, if you already have a string in some other encoding, by converting it to Unicode (the original encoding must be specified if the string is non-ASCII).
Or by using Python 3 where all strings are Unicode.