handler = open('textfile.txt') for line in handler: if line.startswith('From:') : #State your criteria. For example, the line must start with "From:" print(line)
handler = open('textfile.txt') for line in handler: if line.startswith('From:') : #State your criteria. For example, the line must start with "From:" print(line)