Re: 'indent'ing Python in windows bat

2012-09-20 Thread Duncan Booth
Jason Friedman wrote: >> 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'

Re: Re: 'indent'ing Python in windows bat

2012-09-19 Thread David Smith
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 of

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Hans Mulder
On 19/09/12 19:51:44, Albert Hopkins wrote: > On Tue, 2012-09-18 at 22:12 -0600, Jason Friedman wrote: >>> 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 sy

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Terry Reedy
On 9/19/2012 8:27 AM, David Smith wrote: but not: print('hi');if 1: print('hi') Chokes on the 'if'. On the surface, this is not consistent. Yes it is. ; can only be followed by simple statements. The keyword for compound statememts must be the first non-indent token on a line. That is why I

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Albert Hopkins
On Tue, 2012-09-18 at 22:12 -0600, Jason Friedman wrote: > > 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

Re: Re: 'indent'ing Python in windows bat

2012-09-19 Thread David Smith
On 2012-09-19 05:22, Thomas Rachel wrote: Am 18.09.2012 15:03 schrieb David Smith: I COULD break down each batch file and write dozens of mini python scripts to be called. I already have a few, too. Efficiency? Speed is bad, but these are bat files, after all. The cost of trying to work with a

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Thomas Rachel
Am 18.09.2012 15:03 schrieb David Smith: I COULD break down each batch file and write dozens of mini python scripts to be called. I already have a few, too. Efficiency? Speed is bad, but these are bat files, after all. The cost of trying to work with a multitude of small files is high, though, a

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Hans Mulder
On 18/09/12 05:01:14, Ian Kelly wrote: > On Mon, Sep 17, 2012 at 7:08 PM, David Smith 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 == 'Per

Re: 'indent'ing Python in windows bat

2012-09-18 Thread Jason Friedman
> 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=='Perfo

Re: 'indent'ing Python in windows bat

2012-09-18 Thread David Smith
Thank you all. Roy Smith gets the most thanks, though he didn't answer my general question -- he showed me how to look at that specific structure differently. Terry Reedy might get thanks for her idea if I can ever figure the correct escape sequences that will make both windows and the Python i

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Dave Angel
On 09/18/2012 01:08 AM, Terry Reedy wrote: > On 9/17/2012 9: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 >> ti

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Terry Reedy
On 9/17/2012 9: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 line

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Chris Rebert
On Mon, Sep 17, 2012 at 8:28 PM, Dennis Lee Bieber wrote: > On Mon, 17 Sep 2012 21:08:32 -0400, David Smith > declaimed the following in gmane.comp.python.general: > >> >> How do I "indent" if I have something like: >> if (sR=='Cope'): sys.exit(1) elif (sR=='Perform') sys.exit(2) else >> sys.exit

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Tim Roberts
David Smith wrote: > >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)

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Roy Smith
In article , Ian Kelly wrote: > On Mon, Sep 17, 2012 at 7:08 PM, David Smith 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 == 'Perfor

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Ian Kelly
On Mon, Sep 17, 2012 at 7:08 PM, David Smith 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 re

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Dave Angel
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

'indent'ing Python in windows bat

2012-09-17 Thread David Smith
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 "i