On Friday, May 30, 2014 6:22:24 AM UTC+5:30, Chris Angelico wrote: > Since lines are so critical to Python syntax, I'm a little surprised > there's no majorly obvious solution to this... or maybe I'm just > blind.
> Problem: Translate this into a shell one-liner: > import os > for root, dirs, files in os.walk("."): > if len(dirs + files) == 1: print(root) I would have thought this would work: python -m os -c 'for root, dirs, files in os.walk("."): if len(dirs + files) == 1: print(root)' Unfortunately doesn't But did show up a small doc-bug: This fact is not documented in $ man python but is documented in $ python -h Anyways... I thought when one signs up for python one has to sign an affidavit saying: "I shall not write one-liners\n" * 100 -- https://mail.python.org/mailman/listinfo/python-list