I'm trying to parse a log file for all ip addresses but can't get my RE to work. Thanks in advance for pointing me in the right direction
#IP address parse ############################## import re infile = open("host0_declare.txt","r") outfile = open("out.txt","w") patt = re.compile(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3})\.(\[0-9]{1,3}) for line in infile: m = patt.match(line) if m: outfile.write("%s.%s.%s.%s\n"%m.groups()) infile.close() outfile.close() #############################
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor