syntax for -c cmd

Simon Brunning simon at
Wed May 10 20:49:33 CEST 2006

On 5/10/06, Fredrik Lundh <fredrik at> wrote:
> James wrote:
> > Wrong syntax is shown below. What should be the delimiter before else?
> >
> > python -c 'if 1==1: print "yes"; else print "no"'
> there is no such delimiter.  Python's syntax doesn't allow you to put multiple
> clauses on a single line.  if your shell supports it, use a "here document", or
> embedded newlines.  if not, use a script.

Or there's always this; cool in a "The Dark Side is strong" kind of a way:


Simon B,
simon at,

More information about the Python-list mailing list