On Sun, Jan 24, 2016 at 1:45 PM, Terry Reedy <[email protected]> wrote:
> C:\Users\Terry>python -c "for i in range(5):\n\tprint('hello world')"
> File "<string>", line 1
> for i in range(5):\n print('hello world')
> ^
> SyntaxError: unexpected character after line continuation character
>
> -c does not preprocess the code string before executing. I may propose that
> it do so.
As an alternative, maybe multiple -c parameters could result in
multiple lines? Something like:
python3 -c "for i in range(5):" -c " print('Hello, world')"
Currently, a second -c is unparsed (it ends up in sys.argv), so this
would technically be a behavioural change (but then, so would
preprocessing).
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list