On Mar 17, 2:18 am, Peter Otten <__pete...@web.de> wrote:
> Mensanator wrote:
> > On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote:
> >> mattia wrote:
> >> > I have 2 lists, like:
> >> > l1 = [1,2,3]
> >> > l2 = [4,5]
> >> > now I want to obtain a this new list:
> >> > l = [(1,4),(1,5),(2,4
Il Tue, 17 Mar 2009 08:18:08 +0100, Peter Otten ha scritto:
> Mensanator wrote:
>
>> On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote:
>>> mattia wrote:
>>> > I have 2 lists, like:
>>> > l1 = [1,2,3]
>>> > l2 = [4,5]
>>> > now I want to obtain a this new list: l =
>>> > [(1,4),(1,5),(2,4)
Mensanator wrote:
> On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote:
>> mattia wrote:
>> > I have 2 lists, like:
>> > l1 = [1,2,3]
>> > l2 = [4,5]
>> > now I want to obtain a this new list:
>> > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
>> > Then I'll have to transform the values found in
On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote:
> mattia wrote:
> > I have 2 lists, like:
> > l1 = [1,2,3]
> > l2 = [4,5]
> > now I want to obtain a this new list:
> > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
> > Then I'll have to transform the values found in the new list.
> > Now, some
mattia wrote:
> I have 2 lists, like:
> l1 = [1,2,3]
> l2 = [4,5]
> now I want to obtain a this new list:
> l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
> Then I'll have to transform the values found in the new list.
> Now, some ideas (apart from the double loop to aggregate each element of
> l1 with
mattia:
> Now, some ideas (apart from the double loop to aggregate each element of
> l1 with each element of l2):
>>> from itertools import product
>>> list(product([1,2,3], [4,5]))
[(1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)]
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-
On Monday 16 March 2009 15:07:06 mattia wrote:
> I have 2 lists, like:
> l1 = [1,2,3]
> l2 = [4,5]
> now I want to obtain a this new list:
> l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
> Then I'll have to transform the values found in the new list.
> Now, some ideas (apart from the double loop to agg