newbie problem

Frank Buss fb at
Tue Aug 27 19:10:03 CEST 2002

Manuel Hendel <manuel at> 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:

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]
    for field in fields:
      sys.stdout.write('|' + field)

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,

More information about the Python-list mailing list