'indent'ing Python in windows bat
Roy Smith
roy at panix.com
Mon Sep 17 23:17:54 EDT 2012
In article <mailman.854.1347937306.27098.python-list at python.org>,
Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Mon, Sep 17, 2012 at 7:08 PM, David Smith <davids at invtools.com> wrote:
> > How do I "indent" if I have something like:
> > if (sR=='Cope'): sys.exit(1) elif (sR=='Perform') sys.exit(2) else
> > sys.exit(3)
>
> How about:
>
> if sR == 'Cope':
> sys.exit(1)
> elif sR == 'Perform':
> sys.exit(2)
> else:
> sys.exit(3)
>
> I don't really understand why you're trying to keep it all on one line.
sys.exit({'Cope':1, 'Perform':2}.get(sR, 3))
More information about the Python-list
mailing list