python 判断某个字符串是否包含某个子字符串

一个例子看懂:

s = "I am a beautiful girl"
if s.find("beautiful") == -1:
    print("beautiful is not in the string")
else:
    print("beautiful is in the string")
0

Leave a Reply

Your email address will not be published.