Multi-line commands with 'python -c'

Rustom Mody rustompmody at gmail.com
Fri May 30 02:54:15 EDT 2014


On Friday, May 30, 2014 12:15:46 PM UTC+5:30, Rustom Mody wrote:
> Heres a (poooor) approx
> 
> $ python -c 'import os, pprint; pprint.pprint ([ r for r, d, f in os.walk(".") if len(d+f) != 1])'

Without pprint: (pooor)

python -c 'import os; print "\n".join([ r for r, d, f in os.walk(".") if len(d+f) != 1])'

Or (poor)

python -c 'from os import walk; print "\n".join([ r for r, d, f in walk(".") if len(d+f) != 1])'



More information about the Python-list mailing list