【发布时间】:2016-03-17 05:17:36
【问题描述】:
我需要生成长度在 5-15 之间的所有可能核苷酸组合的列表。
nucleotides = ['A', 'T', 'G', 'C']
预期结果:
AAAAA
AAAAT
AAAAC
AAAAG
AAATA
AAATT
...
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAT
etc.
我试过了:
for i in range(5,16):
for j in itertools.permutations(nucleotides, i):
print j
但是如果len(nucleotides) < i,这不起作用。
提前致谢!
【问题讨论】:
标签: python combinations permutation bioinformatics itertools