The fundamentals...

Mike Read mread at cableinet.co.uk
Wed Jan 24 18:00:53 EST 2001


Newbie first script alert!  No problem - it does what I intended (which
probably says more about Python than me...), but I just wanted to start
off on the right foot - is it as elegant as it could be?  If it's not blindingly
obvious, I was separating fields around a period delimiter.

Cheers,

Mike


import string
test = open('\\Windows\\Desktop\\test.txt', 'r')
boo = test.read()
boo = string.split(boo , ". ")
boo = string.join(boo , "\n")

outfile = open('\\Windows\\Desktop\\out.txt', 'w')
outfile.write(boo)
outfile.close()






More information about the Python-list mailing list