>>> from itertools import product >>> a=['1','2','3'] >>> b=['bc','b'] >>> c=['#'] >>> map("".join, product(a,b,c)) ['1bc#', '1b#', '2bc#', '2b#', '3bc#', '3b#']
edit:
you can use the product on a bunch of things as you would like also
>>> list_of_things = [a,b,c] >>> map("".join, product(*list_of_things))
John la rooy
source share