# Search for lines that contain 'From' import re hand = open('mbox-short.txt') for line in hand: line = line.rstrip() if re.search('From:', line): print(line) # Code: http://www.py4e.com/code3/re01.py
# Search for lines that contain 'From' import re hand = open('mbox-short.txt') for line in hand: line = line.rstrip() if re.search('From:', line): print(line) # Code: http://www.py4e.com/code3/re01.py