浏览量 3629
2018/09/10 18:00
>>> import itertools
>>> iter=itertools.permutations([1,2,3])
>>> iter
<itertools.permutations object at 0x0000000002209780>
>>> list(iter)
[(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]
>>>
>>>
>>> dir(itertools)
['__doc__', '__name__', '__package__', 'chain', 'combinations', 'combinations_with_replacement', 'compress', 'count', 'cycle', 'dropwhile', 'groupby',
'ifilter', 'ifilterfalse', 'imap', 'islice', 'izip', 'izip_longest', 'permutations', 'product', 'repeat', 'starmap', 'takewhile', 'tee']
>>>
上一篇 搜索 下一篇