python执行报错
import res = 'skdfhlaknhl'a = re.findall(r'(\d+\.\d+\.\d+\.\d+)', s)print aif a != []: a = selse : a = a[0]print a
import MySQLdbimport reip_patt = re.compile(r'(\d+\.\d+\.\d+\.\d+)')im_file=r'/20120528.txt'def ln_parser(ln): p4, s=line.split(';')[3:4] match = ip_patt.match(s) a = '' if not match else match.group(1) return (p4, a)todo = list(set(map(ln_parser, open(im_file,'r'))))conn = MySQLdb.Connect(host="localhost",user="root",passwd="1111",db="111")conn.executemany("insert into cbd.domain values (%s,%s)",todo)conn.commit()conn.close()