dimanche 5 avril 2015

unicode string equivalent of contain

I have an error when trying to use contain in python.



s = u"some utf8 words"
k = u"one utf8 word"

if s.contains(k):
print "contains"


How do i achieve the same result?


Example with normal ASCII string



s = "haha i am going home"
k = "haha"

if s.contains(k):
print "contains"


I am using python 2.7.x


Aucun commentaire:

Enregistrer un commentaire