On Tue, 29 Nov 2005 17:40:08 GMT in comp.lang.python, Thomas Liesner <[EMAIL PROTECTED]> wrote: [...]> >So instead of: > >3905 >3009 >0000 [...] > >i'd like to have: > >3905 3009 0000 [...] > >This is the codesnippet i am using: > >#!/usr/bin/python > >import string >inp = open("xyplan.nobreaks","r") >data = inp.read() >for words in data.split(): > print words >inp.close() > >Any hints?
Here's an obvious, if naive, implementation: data = imp.read().split() for i in range(0,len(data),3): tl = data[i:i+3] for d in tl: print d, print inp.close() HTH, -=Dave -- Change is inevitable, progress is not. -- http://mail.python.org/mailman/listinfo/python-list