Newline at EOF Removal
Alex N
megahrtz at gte.net
Sun Jan 8 23:21:58 EST 2006
Thank you guys for all your help. Was able to nail it down.
uh I dunno where i saw the 'wt' at. somewhere online though.
I have to do it in 2 stages though and run through a coula files but it
works.
import re
f = open("oldfile.txt")
w = open("newfile.txt", "w")
for line in f:
if line.strip():
w.write(line)
f.close()
w.close()
g = open("newfile.txt")
x = open("mynewfile.txt", "w")
x.write(g.read().rstrip('\n'))
x.close()
Got around the I/O errors luckily
thanks guys
More information about the Python-list
mailing list