Multi-line commands with 'python -c'

Terry Reedy tjreedy at udel.edu
Fri May 30 11:29:44 EDT 2014


On 5/30/2014 2:45 AM, Rustom Mody wrote:

> $ python -c 'import os, pprint; pprint.pprint ([ r for r, d, f in os.walk(".") if len(d+f) != 1])'
>
> Mysterious that print after a ; is fine whereas for is not

Not at all. Simple statememts can follow ; or :, compound statements cannot.

-- 
Terry Jan Reedy




More information about the Python-list mailing list