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,
相關文章
相關標籤/搜索