Workingwithtext

From XPUB & Lens-Based wiki

Replacing words and output in txt

#import time
f = open('facebookdatapolicy.txt')
print f

out = open('newfilenikos.txt', 'w') #saveas

for line in f:
	line = line.strip().lower()
	text = line.replace('facebook' , 'THE WORLD WE CREATED FOR YOU TO FIT YOUR SELF COMFORTABLY')
	#time.sleep(.2)
	print text 
	out.write(text)
	
out.close()