data = open(filename,'r') bulkemails = data.read() else: print "File not found." raise SystemExit # regex = [email protected] r = re.compile(r'(\b[\w.]+@+[\w.]+.+[\w.]\b)') results = r.findall(bulkemails) emails = "" table = PrettyTable(["id", "/~{id} " , "/members/{id}", "Homepage"]) table.align["id"] = "l" table.align["domain"] = "l" table.align["Homepage"] = "l" table.hrule = 2 table.vrule = 1 for x in results: email = str(x) splited = email.split('@') nick = splited[0] domian = splited[1] url1 = "http://delicias.dia.fi.upm.es/~" + nick + "/" url2 = "http://delicias.dia.fi.upm.es/members/" + nick + "/" url3 = "http://delicias.dia.fi.upm.es/members/" + nick[:2].upper() + nick[2:] + "/" url4 = "" page = "" pattern1 = "" pattern2 = "" check1 = checkUrl(url1)