我有srt格式的字幕 我有功能
def clearSubtitles(subtitles):
for i in subtitles:
if re.search("^\r$", i) != None :
subtitles.remove(i)
if re.search("^\d+\r$", i) != None:
subtitles.remove(i)
在列表中我有subtitles['0\r','00:59:58,084 --> 00:59:58,888\r','Come on!\r']
我需要匹配大小写0\r
中的第一个短语,但是^\d+\r$
匹配我timewindows(00:59:58,084 --> 00:59:58,888\r)
。。有人能帮帮我吗?在
所以你需要用一个数字来匹配行?在
好吧,我想我现在明白你想删除什么了。试试这个:
这将生成一个新列表,其中包含以0或更多数字开头、以removed结尾的所有元素。重新匹配要求regexp匹配整个字符串,不像搜索. 在
相关问题 更多 >
编程相关推荐