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


Groups > comp.lang.python > #57210

Re: python -c commands on windows.

References <l443sd$er5$1@ger.gmane.org> <1382390051.14804.36774153.32DD8EAD@webmail.messagingengine.com>
Date 2013-10-22 08:26 +1100
Subject Re: python -c commands on windows.
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1324.1382390796.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Oct 22, 2013 at 8:14 AM,  <random832@fastmail.us> wrote:
> C:\>python -c a=1^
> More?
> More? print(a)
> 1

Note that you have to hit enter *twice* for this to work. (I'm not
sure why; the caret is supposed to escape the newline, but that
doesn't explain this. For all I know, it could be an ascended bug[1].)
Also, if you want to indent a subsequent line, you'll (obviously) have
to quote it (at least, if you use spaces; I don't know of a way to
insert a tab character), so this gets ugly REAL fast for conditionals:

C:\Python33>python -c "if True:"^
More?
More? " print(1)"^
More?
More? else":"^
More?
More? " print(2)"
1

Makes bash look pretty awesome!

ChrisA

[1] http://tvtropes.org/pmwiki/pmwiki.php/Main/AscendedGlitch

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


Thread

Re: python -c commands on windows. Chris Angelico <rosuav@gmail.com> - 2013-10-22 08:26 +1100

csiph-web