python itertools

葫芦的运维日志

下一篇 搜索 上一篇

浏览量 3086

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']
>>>

 

葫芦的运维日志

打赏

上一篇 搜索 下一篇
© 冰糖葫芦甜(bthlt.com) 2021 王梓打赏联系方式 陕ICP备17005322号-1