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

使用in方法:

testStr = 'helloworld'

if 'world' in testStr:
    print ('Exist')
else:
    print ('Not exist')
posted @ 2018-10-11 16:16  Linux黑客小课堂  阅读(99)  评论(0)    收藏  举报