pattern combinations

dohertywa dohertywa at gmail.com
Mon Sep 17 16:12:18 EDT 2007


On Sep 17, 3:11 pm, "Shawn Milochik" <Sh... at Milochik.com> wrote:
> On 9/17/07, dorje tarap <dorjeta... at googlemail.com> wrote:
>
>
>
> > 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
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> Sounds like homework to me.

Checkout http://probstat.sf.net/ it will sort you out quick.




More information about the Python-list mailing list