I'm trying to filter every IP-adress found in an access.log (which is read-in and converted to a string) and then count their occurences. I can do this but the format of the IP-adresses in the list is weird. One element of the list is "('110', '78', '168', '85')" instead of "('110.78.168.85')". How do I make it look like an IP-adress?
I've tried to read other answers on Stackoverflow but none of them seemed to solve my problem.
import re
f = open("/var/log/apache2/access.log", "r")
f_as_string = f.read()
f.close()
x = re.findall(r'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', f_as_string)
# ...
('110.78.168.85')
instead of
('110', '78', '168', '85')