User:Manetta/scripts/python-find-write

From XPUB & Lens-Based wiki
< User:Manetta
Revision as of 10:56, 24 March 2015 by Manetta (talk | contribs) (Created page with "<source lang="python"> import itertools # Open text file for reading with open('WRITE.txt', 'w') as txt: f = open('INPUT.txt', 'r') for line in f: if "SEARCHTERM" in li...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
import itertools

# Open text file for reading
with open('WRITE.txt', 'w') as txt:

	f = open('INPUT.txt', 'r')
	for line in f:
		if "SEARCHTERM" in line: 
			selection = line
			print selection
			txt.write(selection), "\n"
	f.close()