Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29404 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2012-09-17 21:01 -0600 |
| Last post | 2012-09-19 09:53 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: 'indent'ing Python in windows bat Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-17 21:01 -0600
Re: 'indent'ing Python in windows bat Roy Smith <roy@panix.com> - 2012-09-17 23:17 -0400
Re: 'indent'ing Python in windows bat Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 09:53 +0200
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2012-09-17 21:01 -0600 |
| Subject | Re: 'indent'ing Python in windows bat |
| Message-ID | <mailman.854.1347937306.27098.python-list@python.org> |
On Mon, Sep 17, 2012 at 7:08 PM, David Smith <davids@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.
[toc] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-09-17 23:17 -0400 |
| Message-ID | <roy-042AE8.23175417092012@news.panix.com> |
| In reply to | #29404 |
In article <mailman.854.1347937306.27098.python-list@python.org>,
Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Mon, Sep 17, 2012 at 7:08 PM, David Smith <davids@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))
[toc] | [prev] | [next] | [standalone]
| From | Hans Mulder <hansmu@xs4all.nl> |
|---|---|
| Date | 2012-09-19 09:53 +0200 |
| Message-ID | <50597a08$0$6961$e4fe514c@news2.news.xs4all.nl> |
| In reply to | #29404 |
On 18/09/12 05:01:14, Ian Kelly wrote:
> On Mon, Sep 17, 2012 at 7:08 PM, David Smith <davids@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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web