當前位置:成語大全網 - 新華字典 - Python 正則表達式如何提取指定的內容?

Python 正則表達式如何提取指定的內容?

s = '顏色分類:紅色 尺碼:M 主要顏色:橘色 尺寸:S 顏色分類:黃色 尺碼:L'

text = 'asdasdasasd 紅色M 46546546'

c = re.findall(':(\w+?) .*?:([A-Z])', s)

for x in c:

if text.find(''.join(x)) > -1:

print(x)