Python 字符串包含
在Python中,可以使用in运算符来判断一个字符串是否包含另一个字符串。
例如:
string1 = "Hello, World!"
string2 = "Hello"
if string2 in string1:
print("string1包含string2")
else:
print("string1不包含string2")
输出结果是:string1包含string2
原文地址: http://www.cveoy.top/t/topic/iT4B 著作权归作者所有。请勿转载和采集!