Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72287
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'friday,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; "'from": 0.16; 'os;': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'matching': 0.30; 'os,': 0.31; 'subject:with': 0.35; 'there': 0.35; 'to:addr :python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; '30,': 0.65; 'subject:commands': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Multi-line commands with 'python -c' |
| Date | Fri, 30 May 2014 09:33:24 +0200 |
| Organization | None |
| References | <mailman.10468.1401411146.18130.python-list@python.org> <25135194-b9cb-4942-bead-c1bdf72923ee@googlegroups.com> <bc4414a4-ff30-4a72-9b86-2adb3e3c9578@googlegroups.com> <1243054d-84af-46d5-ae7e-5882f35c0b69@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bdbd86.dip0.t-ipconnect.de |
| User-Agent | KNode/4.11.5 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10480.1401435220.18130.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1401435220 news.xs4all.nl 2966 [2001:888:2000:d::a6]:36055 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:72287 |
Show key headers only | View raw
Rustom Mody wrote:
> 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])'
If there are a lot of matching folders:
$ python -c 'import os, sys; sys.stdout.writelines(p + "\n" for p, f, n in
os.walk(".") if len(n+f) == 1)'
With a little help from the shell:
$ echo -e "import os\nfor p, f, n in os.walk('.'):\n if len(f+n) == 1:
print(p)" | python
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multi-line commands with 'python -c' Chris Angelico <rosuav@gmail.com> - 2014-05-30 10:52 +1000
Re: Multi-line commands with 'python -c' Rustom Mody <rustompmody@gmail.com> - 2014-05-29 23:04 -0700
Re: Multi-line commands with 'python -c' Rustom Mody <rustompmody@gmail.com> - 2014-05-29 23:45 -0700
Re: Multi-line commands with 'python -c' Rustom Mody <rustompmody@gmail.com> - 2014-05-29 23:54 -0700
Re: Multi-line commands with 'python -c' Peter Otten <__peter__@web.de> - 2014-05-30 09:33 +0200
Re: Multi-line commands with 'python -c' Terry Reedy <tjreedy@udel.edu> - 2014-05-30 11:29 -0400
Re: Multi-line commands with 'python -c' Chris Angelico <rosuav@gmail.com> - 2014-05-30 17:20 +1000
Re: Multi-line commands with 'python -c' Rustom Mody <rustompmody@gmail.com> - 2014-05-30 05:47 -0700
Re: Multi-line commands with 'python -c' Chris Angelico <rosuav@gmail.com> - 2014-05-30 22:58 +1000
Re: Multi-line commands with 'python -c' Duncan Booth <duncan.booth@invalid.invalid> - 2014-05-30 21:11 +0000
Re: Multi-line commands with 'python -c' Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-05-30 14:42 -0700
Re: Multi-line commands with 'python -c' Chris Angelico <rosuav@gmail.com> - 2014-05-31 07:47 +1000
Re: Multi-line commands with 'python -c' Duncan Booth <duncan.booth@invalid.invalid> - 2014-05-31 16:41 +0000
Re: Multi-line commands with 'python -c' Peter Otten <__peter__@web.de> - 2014-05-31 19:11 +0200
Re: Multi-line commands with 'python -c' Duncan Booth <duncan.booth@invalid.invalid> - 2014-06-01 20:43 +0000
csiph-web