判断字符串是否包含某个子字符串,我们可以使用 in
或者 not in
操作符判断子字符串是否包含在字符串里面。
if "abc" in text:
pass
if "abc" not in text:
pass
关注公众号「Python之禅」,回复「1024」免费获取Python资源

判断字符串是否包含某个子字符串,我们可以使用 in
或者 not in
操作符判断子字符串是否包含在字符串里面。
if "abc" in text:
pass
if "abc" not in text:
pass
关注公众号「Python之禅」,回复「1024」免费获取Python资源