newbie problem
Frank Buss
fb at frank-buss.de
Tue Aug 27 15:06:21 EDT 2002
"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()[0]=='#':
> tag=line.split()[2]
> 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
mailing list