【python】python基本语法

字符串

字符串是否包含子字符串

两种方法:[find()] [in]/[not in]

// 方法一
if string1.find(string2):
    print("found string2 in string1")
// 方法二
if string2 in string1:
    print("found string2 in string1")
posted @ 2023-02-22 09:36  山上有只羊  阅读(16)  评论(0)    收藏  举报