syntax for -c cmd

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


On 5/10/06, Fredrik Lundh <fredrik at pythonware.com> 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:

<http://www.unixuser.org/~euske/pyone/>

--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list