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


Groups > comp.lang.python > #57208

Re: python -c commands on windows.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
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; '21,': 0.07; 'continuation': 0.07; 'received:internal': 0.09; 'spaces': 0.09; 'statements': 0.09; 'python': 0.11; 'windows': 0.15; '(same': 0.16; 'command.': 0.16; 'ignoring': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'processor,': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'reedy': 0.16; 'separated': 0.16; 'syntaxerror:': 0.16; 'unexpected': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; 'command': 0.22; 'manual': 0.22; 'mon,': 0.24; 'file.': 0.24; 'header:In- Reply-To:1': 0.27; 'to:2**1': 0.27; 'feature': 0.29; 'character': 0.29; 'code': 0.31; '"",': 0.31; 'obscure': 0.31; 'quotes': 0.31; 'file': 0.32; 'says': 0.33; 'received:66': 0.35; 'possible.': 0.35; 'but': 0.35; 'so,': 0.37; 'received:10': 0.37; 'follows:': 0.38; 'work?': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'remove': 0.60; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.63; 'more': 0.64; 'prompt': 0.68; 'more?': 0.84; 'subject:commands': 0.84; '2013,': 0.91
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= czOJX7t66LkuqgFEkGDk3aIH6Es=; b=GPl8kiL5xEDEjnLng877U67o4lnXdG0V JgHJK0//DoorCSEktUjov4oaJ6iUkBWTC3bNjQ6kMdCafXQZFwiDpm1zl8bmIj+U uOC7l49Ds0m+XqJDdzugwpxBXwTrbJPl5TgkgBY2xhGRpRSmVLS2/FMtHEGXDjTs TaimmyI0Fkc=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=czOJX7t66LkuqgFEkGDk3aIH6Es=; b=XBO vpJCAR+b1r57W8rqg0peON2LhW6BVtme1/HW4wqm1T0fvcl6MU7IMX5gG71TYTVw WeYs30rNRKMp14xkNubbFvn0qC7h8F0MT211PP7rX1P1eJS2u2eFHpahim/DEu2P G1rTNwEEwN/pjdLzpspuCxea47i9+yjDofNaI2tk=
X-Sasl-Enc wP5qTIWqizZZs9LPGoL8Xm9cC3pWxbreM6fQNPhyapBv 1382390051
From random832@fastmail.us
To Terry Reedy <tjreedy@udel.edu>, python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-0cc2f9cc
In-Reply-To <l443sd$er5$1@ger.gmane.org>
References <l443sd$er5$1@ger.gmane.org>
Subject Re: python -c commands on windows.
Date Mon, 21 Oct 2013 17:14:11 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1323.1382390053.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382390053 news.xs4all.nl 15863 [2001:888:2000:d::a6]:49006
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57208

Show key headers only | View raw


On Mon, Oct 21, 2013, at 16:47, Terry Reedy wrote:
> Manual says "-c <command>
>      Execute the Python code in command. command can be one or more 
> statements separated by newlines, with significant leading whitespace as 
> in normal module code."
> 
> In Windows Command Prompt I get:
> C:\Programs\Python33>python -c "a=1\nprint(a)"
>    File "<string>", line 1
>      a=1\nprint(a)
>                  ^
> SyntaxError: unexpected character after line continuation character
> (Same if I remove quotes.)
> 
> How do I get this to work?

Well, ignoring the "why would you want to" factor... this actually _is_
possible.

C:\>python -c a=1^
More?
More? print(a)
1

You can put quotes around any part of the command you need spaces in,
but you _cannot_ have the ^ in quotes. So, with quotes, it would be as
follows:

C:\>python -c "a='1 2'"^
More?
More? print(a)
1 2

This is a very obscure feature of the command processor, and I don't
know if it works inside a batch file.

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


Thread

Re: python -c commands on windows. random832@fastmail.us - 2013-10-21 17:14 -0400

csiph-web