Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57242 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2013-10-22 09:31 +0200 |
| Last post | 2013-10-22 09:31 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: python -c commands on windows. Peter Otten <__peter__@web.de> - 2013-10-22 09:31 +0200
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2013-10-22 09:31 +0200 |
| Subject | Re: python -c commands on windows. |
| Message-ID | <mailman.1341.1382427113.18130.python-list@python.org> |
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?
>From the odd workarounds department (not tested on Windows):
$ python3 -c "exec('a=1\nprint(a)')"
1
Back to top | Article view | comp.lang.python
csiph-web