这是我在 stackoverflow 上提出的第一个问题,我真的很期待成为这个社区的一员。我是编程新手,python 是很多人最推荐的第一个程序。
反正。我有一个如下所示的日志文件:
"No.","Time","Source","Destination","Protocol","Info"
"1","0.000000","120.107.103.180","172.16.112.50","TELNET","Telnet Data ..."
"2","0.000426","172.16.112.50","172.16.113.168","TELNET","Telnet Data ..."
"3","0.019849","172.16.113.168","172.16.112.50","TCP","21582 > telnet [ACK]"
"4","0.530125","172.16.113.168","172.16.112.50","TELNET","Telnet Data ..."
"5","0.530634","172.16.112.50","172.16.113.168","TELNET","Telnet Data ..."
我想使用 Python 解析日志文件,使其看起来像这样:
从 IP 135.13.216.191 协议计数:(IMF 1)(SMTP 38)(TCP 24)(总数:63)
我真的很想得到一些帮助来解决这个问题,我应该使用列表并循环遍历它还是字典/元组?
在此先感谢您的帮助!