「Python」findallメソッドのサンプル
findall()
マッチする部分すべてをリストで取得します
使用例
# coding: utf-8
import re
str = "ST"
res = re.findall(str,'2infoSTASTeeeST')
if res:
print(res[0])
print(res[1])
else:
print(res)
実行結果
>python test.py
ST
ST