运行 ❯
获取您自己的
Python 服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
import re txt = "The rain in Spain falls mainly in the plain!" #Check if the string contains either "falls" or "stays": x = re.findall("falls|stays", txt) print(x) if x: print("Yes, there is at least one match!") else: print("No match")
['falls']
是的,至少有一处匹配!