(4), [3,2,1])
>>> print(list(x))
[0, 1, 2, 0, 1, 2, 3, 3, 2, 1]
itertools.combinations
求列表或生成器中指定数目的元素不重复的所有组合...>>> x = itertools.compress(range(5), (True, False, True, True, False))
>>> print(list(x))
[0, 2, 3]...itertools.dropwhile(lambda e: e < 5, range(10))
>>> print(list(x))
[5, 6, 7, 8, 9]
itertools.filterfalse
保留对应真值为False...(x))
[0, 2, 4, 6, 8]
itertools.permutations
产生指定数目的元素的所有排列(顺序有关)
>>> x = itertools.permutations(range..., False, False, False, True, True, False, True, False]
itertools.takewhile
与dropwhile相反,保留元素直至真值函数值为假