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

第一种方法:in string = 'helloworld' if 'world' in string:   print 'Exist' else:   print 'Not exist' 第二种方法:find string = 'helloworld' if string.find(’world‘) == 5: #5的意思是world字符从那个序开始,由于w位于第六个,及序为5,
相关文章
相关标签/搜索