On Aug 24, 5:35 am, Boris Borcic [EMAIL PROTECTED] wrote:
Paul Rubin wrote:
beginner [EMAIL PROTECTED] writes:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
beginner [EMAIL PROTECTED] writes:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
--
http://mail.python.org/mailman/listinfo/python-list
Boris Borcic [EMAIL PROTECTED] writes:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
no, that one will be [[[1,2], [f(1), f(2)]], [[3,4], [f(3), f(4)]]]
eg
Paul Rubin wrote:
beginner [EMAIL PROTECTED] writes:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
no, that one will be [[[1,2], [f(1), f(2)]], [[3,4], [f(3),
On Aug 24, 12:44 am, beginner [EMAIL PROTECTED] wrote:
On Aug 24, 12:41 am, Davo [EMAIL PROTECTED] wrote:
On Aug 23, 9:24 pm, beginner [EMAIL PROTECTED] wrote:
Hi All,
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I
On Aug 24, 5:47 am, Paul Rubin http://[EMAIL PROTECTED] wrote:
Boris Borcic [EMAIL PROTECTED] writes:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
no,
Boris Borcic wrote:
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, map(f,a)] for a in x]
[map(g,a) for a in x for g in [None,f]]
will do it.
...a bit too cleverly, but there's worse :
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[[a, [f(b) for b in a]] for a in x]
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[1,2] is mapped to [1,2] and [f(1), f(2)] and [3,4] is mapped to
[3,4], [f(3),
On Aug 23, 9:24 pm, beginner [EMAIL PROTECTED] wrote:
Hi All,
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[1,2] is mapped to
beginner wrote:
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[1,2] is mapped to [1,2] and [f(1), f(2)] and [3,4] is mapped to
On Aug 24, 12:41 am, Davo [EMAIL PROTECTED] wrote:
On Aug 23, 9:24 pm, beginner [EMAIL PROTECTED] wrote:
Hi All,
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
On Aug 23, 9:24 pm, beginner [EMAIL PROTECTED] wrote:
Hi All,
How do I map a list to two lists with list comprehension?
For example, if I have x=[ [1,2], [3,4] ]
What I want is a new list of list that has four sub-lists:
[[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]
[1,2] is mapped to
13 matches
Mail list logo