I need some help printing out a sorted txt logfile. there is no problem with the printing except that I dont want to print out the same IP number more than once.
This is my code.
text_file = open("access_log.txt")
entire_file = text_file.readlines()
text_file.close()
for line in reversed(entire_file):
try:
arr = line.split(' ')
date = arr[3]
print arr[0], "- - ", date[1:], " ",arr[6]
except IndexError, e:
error = e
As you se I just want to print out the IP number, the date and page that been visited. But only once from similar IP.
Well as you maybe see Im a total beginner =) Thanks