Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29525
| Date | 2012-09-19 16:09 -0400 |
|---|---|
| From | David Smith <davids@invtools.com> |
| Subject | Re: Re: 'indent'ing Python in windows bat |
| References | (3 earlier) <505803A9.4000409@davea.name> <mailman.870.1347973403.27098.python-list@python.org> <k3c2st$l6l$1@r03.glglgl.gl> <5059BA28.2090803@invtools.com> <k3d29n$dgd$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.939.1348085390.27098.python-list@python.org> (permalink) |
On 2012-09-19 14:18, Terry Reedy wrote:
> stating correctly that it works for exec().
My mistake. I fancied you were talking shell, not python. I now see that
Python 3 has exec() as a built-in.
python -c "exec('print(\"hi\")\nif 0:\n print(\"hi\")\nelif 1:\n
print(\"hi2\")')"
worked right off the *.bat. Shades of sed!
Note I used a one space indentation. A tab works fine, too.
> python -c "exec('print(%1)\nif 1: print(2)')"
> and calling 'tem 3' prints
> 3
> 2
Thanks for the exhaustive study. :-) I'll keep it in mind. I hope I
don't have to do this, though.
> That said, if you have many multiline statements, putting them in a
> separate file or files may be a good idea.
ASAP I'm hoping to have each bat swallowed completely by python. My
current "bathon" or "pytch" file closes an old session then opens the
session I select just like the bat mom used to bake.
Thank you again, Terry, and thanks to all -- even the *nix'ers. Might
come in handy if I get back into that again.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: 'indent'ing Python in windows bat David Smith <davids@invtools.com> - 2012-09-18 09:03 -0400
Re: 'indent'ing Python in windows bat Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-19 11:22 +0200
Re: Re: 'indent'ing Python in windows bat David Smith <davids@invtools.com> - 2012-09-19 08:27 -0400
Re: 'indent'ing Python in windows bat Terry Reedy <tjreedy@udel.edu> - 2012-09-19 14:18 -0400
Re: Re: 'indent'ing Python in windows bat David Smith <davids@invtools.com> - 2012-09-19 16:09 -0400
csiph-web