How to use "while" within the command in -c option of python?

Chris Angelico rosuav at gmail.com
Sat Oct 13 13:47:58 EDT 2012


On Sun, Oct 14, 2012 at 4:43 AM, Jussi Piitulainen
<jpiitula at ling.helsinki.fi> wrote:
> Chris Angelico writes:
>
>> Here's a side challenge. In any shell you like, start with this
>> failing statement, and then fix it without retyping anything:
>>
>> sikorsky at sikorsky:~$ python -c "a=1; if a: print(a)"
>
> C-v C-j inserts a newline for me, in bash.

Ah! So it does. Thanks.

*stashes that away in the "handy commands" index in his brain*

ChrisA



More information about the Python-list mailing list