python -c commands on windows.
Chris Angelico
rosuav at gmail.com
Mon Oct 21 17:26:31 EDT 2013
On Tue, Oct 22, 2013 at 8:14 AM, <random832 at 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
More information about the Python-list
mailing list