Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29401

Re: 'indent'ing Python in windows bat

Date 2012-09-17 21:22 -0400
From Dave Angel <d@davea.name>
Subject Re: 'indent'ing Python in windows bat
References <mailman.3021.1347928001.27097.python-list@python.org> <5057C990.8080809@invtools.com>
Newsgroups comp.lang.python
Message-ID <mailman.852.1347931387.27098.python-list@python.org> (permalink)

Show all headers | View raw


On 09/17/2012 09:08 PM, David Smith wrote:
> Hello, I'm essentially a newbie in Python.
> My problem in searching the archives is not knowing what words to use
> to ask.
>
> I'm converting windows bat files little by little to Python 3 as I
> find time and learn Python.
> The most efficient method for some lines is to call Python like:
> python -c "import sys; sys.exit(3)"
>
> 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)
>
> My sole result in many attempts is "Syntax Error."
>
> Thank you for any help.
>

I don't understand your actual problem.  Python is much more expressive
than batch, so why not actually convert it?

Write a file with an extension of .py, and run it the same way you'd run
a batch file.  This assumes you have Python 3 associated with the .py
extension.

Now it won't matter if the python code has one line, or 100.

-- 

DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 'indent'ing Python in windows bat Dave Angel <d@davea.name> - 2012-09-17 21:22 -0400

csiph-web