User:Manetta/scripts/python-find-write: Difference between revisions

From XPUB & Lens-Based wiki
(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...")
 
(No difference)

Latest revision as of 11:56, 24 March 2015

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()