[BangPypers] need help w.r.t itertools

Dhruv Baldawa dhruvbaldawa at gmail.com
Fri Sep 13 13:31:35 CEST 2013


d = [''.join(x) for x in itertools.product(a, b, c)]

--
Dhruv Baldawa
(http://www.dhruvb.com)


On Fri, Sep 13, 2013 at 4:53 PM, Suyash Bhatt <bhatt.suyash at gmail.com>wrote:

> Hi all,
>
> i need help in finding the most optimized way of making a list using
> itertools.
>
> Suppose I have 3 lists:
>
> *a=[‘my1’,’my2’]
> *
>
> **
>
> *b=[‘name1’,’name2’]*
>
> *c=[‘is1’]*
>
>  I want to iter through all and form another list with the following
> appended strings:
>
> *d=['my1name1is1','my1name2is1','my2name1is1','my2name2is1']*
>
> Can this be done in a single line using the itertools module??
>
>
> Regards,
>
> Suyash
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list