rank vote view answer url
9 3072 2877536 14 url

Python中有检查字符串包含的方法吗?

我正在找string.contains或者string.indexof方法.

我希望:

if not somestring.contains("blah"):
   continue

你可以用in啊:

if not "blah" in somestring: continue

或者:

if "blah" not in somestring: continue