W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
import re
​
txt = "hello planet"
​
# 搜索以 "he" 开头,后跟恰好 2 个(任意)字符,并以 "o" 结尾的序列:
​
x = re.findall("he.{2}o", txt)
​
print(x)