Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 517 Bytes

11.md

File metadata and controls

30 lines (20 loc) · 517 Bytes
rank vote view answer url
11 3599 4214927 10 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