On Thursday, May 29, 2014, Chris Angelico <ros...@gmail.com
> 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
> Problem: Translate this into a shell one-liner:
> import os
> for root, dirs, files in os.walk("."):
> if len(dirs + files) == 1: print(root)
> Is there a better way to put multiple virtual lines into a 'python -c'
You can always cheat:
$ python -c 'exec("import os\nfor root, dirs, files in os.walk(\".\"):\n if
len(dirs + files) == 1: print(root)")'
Doesn't do much for being long and fiddly, though.
Sent from an iPad, please bear with any brevity, uncaught
auto-uncorrections, HTML, or other annoyances. Suggestions for a great (not
just 'good') email app are welcome.
Sent from Gmail Mobile