handler = open('textfile.txt') for line in handler: line = line.rstrip() #rstrip() method removes characters at the end a string. if not line.startswith('From:') : #For this case, we remove any lines between lines staring with "From:"" continue print(line)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter