#!/usr/bin/env python3 # Author: Guillermo Céspedes # Example program, to obtain emails from the raw file. # It can be modified to obtain the name and photo as optional values. import re def grab_email(file = []): found = [] mailsrch = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}') for line in open(file,'r'): found.extend(mailsrch.findall(line)) u = {} for item in found: u[item] = 1 return u.keys() listMails = grab_email('response_raw.txt') fileMail = open('list_mails_6.csv', 'a') for mail in listMails: fileMail.write(mail+'\n') fileMail.close()