我试图从电影标题中捕捉以下组:
file = "The Great Home Se01E01 Meatballs for Dinner"
<show> = "The Great Home"
<season> = "Se01"
<episode> = "E01"
<title> = "Meatballs for Dinner"
目前,我只能部分地捕获并使用以下代码:
import re
file = "The Great Home Se01E01 Meatballs for Dinner"
seasonEpID = re.search(r'(\bS/?.+\d{1,2})+(E/?.+\d{1,2})', file)
print(seasonEpID.groups())
返回以下内容:
('Se01', 'E01')
如何捕捉这四个组<show>
、<season>
、<episode>
、<title>
我将
re.findall
与以下正则表达式模式一起使用:示例脚本:
这张照片是:
相关问题 更多 >
编程相关推荐