pattern combinations

dorje tarap dorjetarap at googlemail.com
Mon Sep 17 15:04:11 EDT 2007


Hi all,

Given some patterns such as "...t...s." I need to make all possible
combinations given a separate list for each position. The length of the
pattern is fixed to 9, so thankfully that reduces a bit of the complexity.

For example I have the following:

pos1 = ['a',' t']
pos2 = ['r', 's']
pos3 = ['n', 'f']

So if the pattern contains a '.' character at position 1 it could be 'a' or
't'. For the pattern '.s.' (length of 3 as example) all combinations would
be:

asn
asf
tsn
tsf

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070917/d60fac25/attachment.html>


More information about the Python-list mailing list