[2.5.1] Read each line from txt file, replace, and save?

Gilles nospam at nospam.com
Sun Sep 2 06:36:48 EDT 2012


On Sun, 02 Sep 2012 12:19:02 +0200, Gilles <nospam at nospam.com> wrote:
(snip)

Found it:

#rewrite lines to new file
output = open('output.txt','w')

for line in textlines:
	#edit each line
	line = "just a test"
	output.write("%s" % line)

output.close()



More information about the Python-list mailing list