我正在寻找 Python 中的 string.contains
或 string.indexof
方法。
我想做:
if not somestring.contains("blah"):
continue
最佳答案
使用 in
operator :
if "blah" not in somestring:
continue
关于python - Python 是否有字符串 'contains' 子字符串方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3437059/