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
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 per
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 the
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 up with
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 with
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. with the
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', '11'], ['e', '5'],
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 up with
Neil Cerutti a écrit :
On 2007-02-02, ardief [EMAIL PROTECTED] wrote:
zip
This is a job for... duhn-duhn-DH! Captain CHAOS!
Er... I mean itertools.groupby.
zip
def key_func(t):
return t[0]
Not needed: -- from operator import itemgetter
See in the example:
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
On 2007-02-02, Laurent Pointal [EMAIL PROTECTED] wrote:
Neil Cerutti a écrit :
On 2007-02-02, ardief [EMAIL PROTECTED] wrote:
zip
This is a job for... duhn-duhn-DH! Captain CHAOS!
Er... I mean itertools.groupby.
zip
def key_func(t):
return t[0]
Not needed: -- from
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 up with
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 the
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 so
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, num in
15 matches
Mail list logo