On Feb 2, 10:34 pm, [EMAIL PROTECTED] wrote:
> Paddy:
>
> >>> _ = [d[x0].append(x1) for x0,x1 in data]
Yep, definitely a case of overdoing the list comprehensions when you
throw away the list.
I'll watch out for that in the future,
Ta.
- Paddy.
>
> I think that you probably want:
>
> for text, n
Paddy:
>>> _ = [d[x0].append(x1) for x0,x1 in data]
I think that you probably want:
for text, num in data: d[text].append(num)
ardief:
> thanks to everyone for the help, and the speed of it! It's really
> useful and I will spend some time working on understanding the code
> you posted. I'd be s
ardief wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end up with something like this, i.e. with
On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end
On 2007-02-02, Laurent Pointal <[EMAIL PROTECTED]> wrote:
> Neil Cerutti a écrit :
>> On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote:
>
>
>> This is a job for... duhn-duhn-DH! Captain CHAOS!
>>
>> Er... I mean itertools.groupby.
>>
>
>> def key_func(t):
>> return t[0]
>
> Not nee
On Feb 2, 3:19 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
> l=[x for x in d.items()]
d.items() is not an iterator, you don´t need this. This code is
equivalent to l = d.items().
--
http://mail.python.org/mailman/listinfo/python-list
Neil Cerutti a écrit :
> On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote:
> This is a job for... duhn-duhn-DH! Captain CHAOS!
>
> Er... I mean itertools.groupby.
>
> def key_func(t):
> return t[0]
Not needed: --> from operator import itemgetter
See in the example:
http://docs
On Feb 2, 2:55 pm, "ardief" <[EMAIL PROTECTED]> wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end
On Feb 2, 2:39 pm, "Paddy" <[EMAIL PROTECTED]> wrote:
> On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everyone
> > Here is my problem:
> > I have a list that looks like this -
> > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> > '4'], ['d', '2'], ['e',
ardief a écrit :
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end up with something like this, i.e. wi
On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end up wi
On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end
ardief wrote:
> Hi everyone
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end up with something like this, i.e. with
Hello,
> Here is my problem:
> I have a list that looks like this -
> [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
> '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
>
> and I would like to end up with something like this, i.e. with the
> only one list pe
Hi everyone
Here is my problem:
I have a list that looks like this -
[['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
'4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
and I would like to end up with something like this, i.e. with the
only one list per letter
15 matches
Mail list logo