newbie problem
Frank Buss
fb at frank-buss.de
Tue Aug 27 13:10:03 EDT 2002
Manuel Hendel <manuel at hendel.net> wrote:
> I would be very
> happy if you can provide me with this program.
Perhaps I can help you. I'm a Python-newbie, too, so it is not the best
Python code, I think, but it works:
#!/usr/bin/python
from string import split
import sys
for line in open('in.txt', 'r').readlines():
fields = split(line)
if len(fields) == 0: continue
if fields[0] == '#':
lastNumber = fields[len(fields) - 1]
else:
sys.stdout.write(lastNumber)
for field in fields:
sys.stdout.write('|' + field)
sys.stdout.write('\n')
Send any questions to this newsgroup, if you don't understand something.
BW: Any experts who can improve it more Python-like?
--
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
More information about the Python-list
mailing list