'indent'ing Python in windows bat
Hans Mulder
hansmu at xs4all.nl
Wed Sep 19 03:53:44 EDT 2012
On 18/09/12 05:01:14, Ian Kelly 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.
He's using Windows.
If he were on Unix, there'd be no problem:
python -c 'import sys
if sR == "Cope":
sys.exit(1)
elif sR == "Perform":
sys.exit(2)
else:
sys.exit(3) '
Unfortunately, the Windows shell doesn't do multi-line strings,
so he has to cram it all on one line.
-- HansM
More information about the Python-list
mailing list