I use a variable to save an ip like this, but I need to verify that it really has an ip format. The ip field does not always have to be a list. I have this:
ip=["8.8.8.8","8.8.8.6"] # List or only one element
reg_ip = r'(?:\d{1,3}\.)+(?:\d{1,3})'
filter_ip=re.findall(reg_ip,ip)
But the answer is as follows
filter_ip= [u"8.8.8.8",u"8.8.8.6"]
And therefore does not meet the condition
if ip == reg_ip:
How should I do it?
re.search()?