I\'m trying to download a txt file which you can find here. Downloading the file is not a problem:
testfile = urllib.URLopener()
testfil
You need to remove anchors, since a line won't contain only a single ip-address.
ip = re.findall( r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b", content )
second regex
r'([0-9]+)(?:\.[0-9]+){3}'
must return three digit number because only the first three digits are captured, re.findall
method would return captures first if there any. If there are no captures, then only it would return the matches. By turning the capturing group into non-capturing group will give you the desired output.
r'\b[0-9]+(?:\.[0-9]+){3}\b'