There is a string consisting of numbers and letters of the Russian alphabet. Need to know the index of one of the letters. When using s.find('Н') an error is s.find('Н') .

I use python-2.7 under Ubuntu .

    3 answers 3

     s.find(u'Н') 
    • Yes, I thought so too at first, but it did not help. - earendill
    • isinstance(s, unicode) - jfs

    It is necessary to transfer the input data to unicode. and call the find () function passing it the unicode object as a parameter.

    You can see here: https://sites.google.com/site/whitedjango/home/pythonilidjangoproblemaskodirovkoj

       string = u'АБВ123' string.find(u'Б') 1