I\'m trying to extract email addresses from plain text transcripts of emails. I\'ve cobbled together a bit of code to find the addresses themselves, but I don\'t know how to mak
if you can be reasonably sure that lines containing these email addresses start with whitespace followed by "From:" you can simply do this:
addresslines = []
for line in open("text.txt"):
if line.strip().startswith("From:"):
addresslines.append(line)
then later - or on adding them to the list - you can refine the addresslines items to give out exactly what you want