unicode string equivalent of contain

前端 未结 4 1173
长情又很酷
长情又很酷 2021-02-12 11:01

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\" 
4条回答
  •  清歌不尽
    2021-02-12 11:30

    Testing of string existance in string

    string = "Little bear likes beer"
    if "beer" in string:
        print("Little bear likes beer")
    else:
        print("Little bear is driving")
    

提交回复
热议问题