def getUnstructuredTime (log, patern, dateFormat):
# Fuction to extrat timestamp from an unstructured source
p = re.search(patern,log)
try:
date_string = p.group(0)
d = datetime.strptime(date_string,dateFormat)
d = d.replace(second = 00)
return d.strftime(dateFormat)
except:
return None
评论列表
文章目录