Я написал рабочий скрипт, который извлекает информацию из файла .csv. Однако при извлечении он выводит всю информацию вместо электронных писем, когда я писал код, чтобы специально искать символы @.
#!/bin/python3
import re
def print_csv():
in_file = open('sample._data.csv', 'rt')
for line in in_file:
if re.findall(r'(.*)@(.*).(.*)', line):
print(line)
print_csv()
Вот пример вывода:
"Carlee","Boulter","Tippett, Troy M Ii","8284 Hart St","Abilene","Dickinson","KS",67410,"785-347-1805","785-253-7049","carlee.boulter@hotmail.com","http://www.tippetttroymii.com"
"Thaddeus","Ankeny","Atc Contracting","5 Washington St #1","Roseville","Placer","CA",95678,"916-920-3571","916-459-2433","tankeny@ankeny.org","http://www.atccontracting.com"
"Jovita","Oles","Pagano, Philip G Esq","8 S Haven St","Daytona Beach","Volusia","FL",32114,"386-248-4118","386-208-6976","joles@gmail.com","http://www.paganophilipgesq.com"
"Alesia","Hixenbaugh","Kwikprint","9 Front St","Washington","District of Columbia","DC",20001,"202-646-7516","202-276-6826","alesia_hixenbaugh@hixenbaugh.org","http://www.kwikprint.com"
"Lai","Harabedian","Buergi & Madden Scale","1933 Packer Ave #2","Novato","Marin","CA",94945,"415-423-3294","415-926-6089","lai@gmail.com","http://www.buergimaddenscale.com"
"Brittni","Gillaspie","Inner Label","67 Rv Cent","Boise","Ada","ID",83709,"208-709-1235","208-206-9848","bgillaspie@gillaspie.com","http://www.innerlabel.com"
"Raylene","Kampa","Hermar Inc","2 Sw Nyberg Rd","Elkhart","Elkhart","IN",46514,"574-499-1454","574-330-1884","rkampa@kampa.org","http://www.hermarinc.com"
"Flo","Bookamer","Simonton Howe & Schneider Pc","89992 E 15th St","Alliance","Box Butte","NE",69301,"308-726-2182","308-250-6987","flo.bookamer@cox.net","http://www.simontonhoweschneiderpc.com"
"Jani","Biddy","Warehouse Office & Paper Prod","61556 W 20th Ave","Seattle","King","WA",98104,"206-711-6498","206-395-6284","jbiddy@yahoo.com","http://www.warehouseofficepaperprod.com"
"Chauncey","Motley","Affiliated With Travelodge","63 E Aurora Dr","Orlando","Orange","FL",32804,"407-413-4842","407-557-8857","chauncey_motley@aol.com","http://www.affiliatedwithtravelodge.com"
Я пытаюсь сделать вывод похожим на список писем. У меня проблемы с фильтрацией другого содержимого из файла CSV.