作者yaohua2000 (周濟是母老鼠)
看板Python
標題Re: [問題] 排列組合
時間Fri Oct 31 22:25:34 2008
# Python 2.6 is required
import itertools
for x in itertools.product(*(['ATCG'] * 8)):
print ''.join(x)
※ 引述《incisive (中肯!)》之銘言:
: 用ATCG排列出所有長度為8的序列組合?
: 原本想用 1..65536 去 mod 4
: 把數字轉換成4進位
: 好像又有點複雜
: 不知道各位有沒有比較好的寫法?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.69.149.138
→ apua:請問*(['ATCG'] * 8)這是什麼意思啊?(汗) 11/04 11:23
→ apua:抱歉我問錯問題了@@a 11/04 11:27