matt_gerrans at hp.com
Wed Aug 28 11:57:46 EDT 2002
Oops -- yes, the "if" was lost in the copy-and-past process (because I did
it from IDLE, and chopped out the ">>> " parts, so that "if" went with one).
"Frank Buss" <fb at frank-buss.de> wrote in message
news:akgijd$bci$2 at newsreader2.netcologne.de...
> "Matt Gerrans" <matt_gerrans at hp.com> wrote:
> > for line in open( r'c:\temp\input.dat' ).readlines():
> > len(line.split()) > 2:
> > if line.split()=='#':
> > tag=line.split()
> > else:
> > print '|'.join([tag]+line.split())
> Thanks, that's what I mean with "more Python-like" :-)
> But I can't write "len(line.split()) > 2:". Python says "SyntaxError:
> invalid syntax" at the colon. Is there an 'if' missing, or can I add
> closure-blocks for booleans in Python like in Smalltalk?
> Frank Buß, fb at frank-buss.de
> http://www.frank-buss.de, http://www.it4-systems.de
More information about the Python-list