1
내가 원하는 것은 모든 조합과 각 조합의 모든 순열을 얻는 것입니다. 대체 기능을 가진 조합은 지금까지 저를 가져옵니다스크램블 된 조합을 생성하는 Itertools
import numpy as np
from itertools import permutations as perm
bar = []
for x in foo:
carp = list(perm(x))
for i in range(len(carp)):
for j in range(i+1,len(carp)):
if carp[i] == carp[j]:
carp[j] = ''
carp = carp[list(np.where(np.array(carp) != '')[0])]
for y in carp:
bar.append(y)
for i in range(len(bar)):
for j in range(i+1,len(bar)):
if bar[i] == bar[j]:
bar[j] = ''
bar = [bar[x2] for x2 in list(np.where(np.array(bar) != '')[0])]
는보다 효율적인 알고리즘이 있나요 : 앞으로 이동하는 방법에 대한
from itertools import combinations_with_replacement as cwr
foo = list(cwr('ACGT', n)) ## n is an integer
내 직감 같은 것을 할 것입니다?
, 즉의 Cartesian product