在python中使用re提取时间
如何从以下数组中提取时间? 现在我正在尝试使用在python中使用re提取时间,python,regex,Python,Regex,如何从以下数组中提取时间? 现在我正在尝试使用re data = ['Mys--dreyn M (00:07:04): Yes', ' of course.\r\n'] time_search = re.search('(*)', "".join(data), re.IGNORECASE) if time_search: time = time_search.group(1) print time 您需要修复re表达式: time_search = re.search('\((
re
data = ['Mys--dreyn M (00:07:04): Yes', ' of course.\r\n']
time_search = re.search('(*)', "".join(data), re.IGNORECASE)
if time_search:
time = time_search.group(1)
print time
您需要修复
re
表达式:
time_search = re.search('\((.*)\)', "".join(data), re.IGNORECASE)
您需要修复
re
表达式:
time_search = re.search('\((.*)\)', "".join(data), re.IGNORECASE)
只是提取时间的另一种方法-在“模糊”模式下使用:
就正则表达式而言,我还将通过检查数字对来改进它:
time_search = re.search('\((\d{2}:\d{2}:\d{2})\)', "".join(data), re.IGNORECASE)
只是提取时间的另一种方法-在“模糊”模式下使用:
就正则表达式而言,我还将通过检查数字对来改进它:
time_search = re.search('\((\d{2}:\d{2}:\d{2})\)', "".join(data), re.IGNORECASE)