为什么我的列表索引超出范围?
ip_list = []
path = r'''mail.log'''
with open(path, 'r') as log:
for line in log:
if "SASL PLAIN authentication failed: authentication failure" in line:
ip_address = line.split("warning: unknown[")[1].split("]")[0]
ip_list.append(ip_address)
输出:
...
ip_address = line.split("warning: unknown[")[1].split("]")[0]
IndexError: list index out of range