multiplication of lists of strings

Jason jasong at gmail.com
Wed Mar 5 02:50:49 CET 2008


How could I return a list or tuple of each unique combination of a given
set of lists (perhaps from a dict or a list).  This means the number of
lists are not known nor is the length of each.

Here is an example:
fruit = ['apple', 'orange']
numbers = ['one', 'two', 'three']
names = ['joe']

Order matters (I started by trying to iterate over a list corresponding
to keys in the dict that contains these lists).  Furthermore, (a, b) is
different from (b, a) however I will filter out all but unique (a, a) if
that occurs.

Once this step is solved, I then will use each tuple as a key in a dict.

I appreciate any assistance you can throw my way.

Jason G



More information about the Python-list mailing list