Peter Otten <__pete...@web.de> wrote:
> Duncan Booth wrote:
>
>> Chris Angelico wrote:
>>
>>> On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre
>>> wrote:
In unix shells you can literally use a new line. Or is that only
>> bash?
>>>
>>> You can in bash, I know, but it's fiddly to type it;
Duncan Booth wrote:
> Chris Angelico wrote:
>
>> On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre
>> wrote:
>>> In unix shells you can literally use a new line. Or is that only
> bash?
>>
>> You can in bash, I know, but it's fiddly to type it; and more
>> importantly, it's not a good point in
Chris Angelico wrote:
> On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre
> wrote:
>> In unix shells you can literally use a new line. Or is that only
bash?
>
> You can in bash, I know, but it's fiddly to type it; and more
> importantly, it's not a good point in the "this is cleaner than a
> se
On Sat, May 31, 2014 at 7:42 AM, Devin Jeanpierre
wrote:
> In unix shells you can literally use a new line. Or is that only bash?
You can in bash, I know, but it's fiddly to type it; and more
importantly, it's not a good point in the "this is cleaner than a
series of pipes" argument. My primary r
In unix shells you can literally use a new line. Or is that only bash?
-- Devin
On Fri, May 30, 2014 at 2:11 PM, Duncan Booth
wrote:
> Chris Angelico wrote:
>
>> Problem: Translate this into a shell one-liner:
>>
>> import os
>> for root, dirs, files in os.walk("."):
>> if len(dirs + files)
Chris Angelico wrote:
> Problem: Translate this into a shell one-liner:
>
> import os
> for root, dirs, files in os.walk("."):
> if len(dirs + files) == 1: print(root)
>
This is one area where Windows seems to do better than Linux shells:
PS C:\python33> python -c "import os`nfor root, di
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 Re
On Fri, May 30, 2014 at 10:47 PM, Rustom Mody wrote:
> On Friday, May 30, 2014 12:50:31 PM UTC+5:30, Chris Angelico wrote:
>> On Fri, May 30, 2014 at 4:04 PM, Rustom Mody wrote:
>> > I thought when one signs up for python one has to sign an affidavit
>> > saying:
>> > "I shall not write one-liners
On Friday, May 30, 2014 12:50:31 PM UTC+5:30, Chris Angelico wrote:
> On Fri, May 30, 2014 at 4:04 PM, Rustom Mody wrote:
> > I thought when one signs up for python one has to sign an affidavit
> > saying:
> > "I shall not write one-liners\n" * 100
> Certainly not. I write all my list comps on one
Rustom Mody wrote:
> On Friday, May 30, 2014 12:15:46 PM UTC+5:30, Rustom Mody wrote:
>> Heres a (pr) 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
On Fri, May 30, 2014 at 4:04 PM, Rustom Mody wrote:
> I thought when one signs up for python one has to sign an affidavit
> saying:
> "I shall not write one-liners\n" * 100
Certainly not. I write all my list comps on one line!
*ducking for cover*
ChrisA
--
https://mail.python.org/mailman/listi
On Friday, May 30, 2014 12:15:46 PM UTC+5:30, Rustom Mody wrote:
> Heres a (pr) 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
l
On Friday, May 30, 2014 11:34:36 AM UTC+5:30, Rustom Mody wrote:
> 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
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, fil
On Fri, May 30, 2014 at 12:34 PM, Zachary Ware
wrote:
> 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.
Not really, no! Heh. I wrote that in compet
On Thursday, May 29, 2014, 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
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)
Solution 1: Syn
17 matches
Mail list logo