Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'elif': 0.04; 'essentially': 0.04; 'subject:Python': 0.05; 'newbie': 0.05; 'python': 0.09; 'extension.': 0.09; 'sys.exit(2)': 0.09; 'cc:addr :python-list': 0.10; 'extension': 0.13; '"import': 0.16; '"syntax': 0.16; '.py': 0.16; 'subject:windows': 0.16; 'sys.exit(1)': 0.16; 'wrote:': 0.17; 'windows': 0.19; 'file.': 0.20; 'assumes': 0.22; 'help.': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'converting': 0.27; 'lines': 0.28; 'actual': 0.28; 'run': 0.28; 'archives': 0.29; 'convert': 0.29; 'words': 0.29; "i'm": 0.29; 'code': 0.31; 'problem.': 0.32; 'file': 0.32; 'like:': 0.33; 'problem': 0.33; 'pm,': 0.35; "won't": 0.35; 'something': 0.35; 'method': 0.36; 'thank': 0.36; 'why': 0.37; 'files': 0.38; 'some': 0.38; 'received:192': 0.39; 'hello,': 0.39; 'little': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'most': 0.61; 'matter': 0.61; 'more': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'smith': 0.71; 'reply-to:no real name:2**0': 0.72; 'sole': 0.75; 'expressive': 0.84 Date: Mon, 17 Sep 2012 21:22:04 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: David Smith Subject: Re: 'indent'ing Python in windows bat References: <5057C990.8080809@invtools.com> In-Reply-To: <5057C990.8080809@invtools.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Qd1qXY/tlJ3AqMgPc/JEWq9tKmx3fhB8DmtNdErvdZR +37dYBcdvSVyvM3saXi/4O17bBln95FWd+sWvbd1YYQyjiIQO8 unkf/AUKI2N9hsk9t+7o/LCDGpHMhgfJ/n7Zdx+He7o14yHkbD CTbJweIz1qy5DcaAB/RIItOXRh63b0P5MdY1yZeLwVfbX+j0lt I3wrCtpfVI+JtNMLhPxYVFD3BAjsjOHe++0Zi6RMvQ7Bxb0jSf 8Au5E1hUolzXG2yoziUOQmQ9soHI7v7NekCuEFAOPQfRCqvele rkCARWfaYDaRrnR/oGvme+utsIhpmImr9SRvZ54wFeo+0NC3Q= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347931387 news.xs4all.nl 6848 [2001:888:2000:d::a6]:43085 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29401 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