发布时间:2019-08-27 08:00:38编辑:auto阅读(2220)
方法1:使用 in 方法实现contains的功能:
site = 'http://www.outofmemory.cn/'
if "sharejs" in site:
print('site contains sharejs')
输出结果:site contains sharejs
方法2:使用find函数实现contains的功能
s = "This be a string"
if s.find("is") == -1:
print "No 'is' here!"
else:
print "Found 'is' in the string."
上一篇: python generator
下一篇: python执行cmd命令
50958
50341
40956
37825
32289
29179
28066
22896
22858
21191
1050°
1728°
1410°
1348°
1609°
1438°
2094°
3636°
3562°
2510°