一些数据包含一个额外的空白,我想去掉它,但不幸的是,在这一点上,它是一个匹配对象,所以我如何删除它
for string in sl:
for keyword in keywordList: #looping through each string in syslog.txt against each keyword in keyword.txt
if keyword in string:
hostnameResult = re.search(r"\s[A-z]+\s", string)
dateResult = re.search(r"^[A-Z][a-z][a-z]\s\s[0-9]+\s[0-9]{2}\:[0-9]{2}\:[0-9]{2}", string)
del(dateResult[3]) <- the part I'm trying to actually do.
print "**"+keyword+"**"+hostnameResult.group(0)+dateResult.group(0)
目前没有回答
相关问题 更多 >
编程相关推荐