coverting list back to string
Erik Max Francis
max at alcyone.com
Tue Apr 22 23:05:42 CEST 2003
> Erik. This worked and thank you. However, the lines of text are all
> one continuous string instead of line-by-line.
That's because with no arguments, S.split() delimits by any chunk of
whitespace, and a newline qualifies:
>>> "The quick brown fox did something really gross.\n".split()
['The', 'quick', 'brown', 'fox', 'did', 'something', 'really', 'gross.']
So your .split operation is removing the newline that exists at the end
of every line that's bein read. If you want to put it back in, just do
it manually with something like:
output.write(' '.join(remove) + '\n')
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Do not stand in a place of danger trusting in miracles.
\__/ (an Arab proverb)
PyQStat / http://www.alcyone.com/pyos/qstat/
A Python wrapper around QStat, the realtime game server status tool.
More information about the Python-list