https://more-itertools.readthedocs.io/en/stable/ more-itertools stable [ ] * API Reference * License * Testing * Version History more-itertools * * More Itertools * Edit on GitHub --------------------------------------------------------------------- More Itertools https://readthedocs.org/projects/more-itertools/badge/?version=latest Python's itertools library is a gem - you can compose elegant solutions for a variety of problems with the functions it provides. In more-itertools we collect additional building blocks, recipes, and routines for working with Python iterables. chunked, ichunked, chunked_even, sliced, Grouping constrained_batches, distribute, divide, split_at, split_before, split_after, split_into, split_when, bucket, unzip, batched, grouper, partition, transpose Lookahead and spy, peekable, seekable lookback windowed, substrings, substrings_indexes, stagger, Windowing windowed_complete, pairwise, triplewise, sliding_window , subslices count_cycle, intersperse, padded, repeat_each, Augmenting mark_ends, repeat_last, adjacent, groupby_transform, pad_none, ncycles collapse, sort_together, interleave, interleave_longest Combining , interleave_evenly, zip_offset, zip_equal, zip_broadcast, dotproduct, convolve, flatten, roundrobin, prepend, value_chain, partial_product ilen, unique_to_each, sample, consecutive_groups, Summarizing run_length, map_reduce, exactly_n, is_sorted, all_equal , all_unique, minmax, first_true, quantify, iequals islice_extended, first, last, one, only, strictly_n, strip, lstrip, rstrip, filter_except, map_except, filter_map, iter_suppress, nth_or_last, Selecting unique_in_window, before_and_after, nth, take, tail, unique_everseen, unique_justseen, duplicates_everseen, duplicates_justseen, classify_unique, longest_common_prefix, takewhile_inclusive distinct_permutations, distinct_combinations, circular_shifts, partitions, set_partitions, product_index, combination_index, permutation_index, combination_with_replacement_index, gray_product, Combinatorics outer_product, powerset, random_product, random_permutation, random_combination, random_combination_with_replacement, nth_product, nth_permutation, nth_combination, nth_combination_with_replacement Wrapping always_iterable, always_reversible, countable, consumer , with_iter, iter_except locate, rlocate, replace, numeric_range, side_effect, iterate, difference, make_decorator, SequenceView, Others time_limited, map_if, iter_index, consume, tabulate, repeatfunc, polynomial_from_roots, polynomial_eval, polynomial_derivative, sieve, factor, matmul, sum_of_squares, totient, reshape Getting started To get started, install the library with pip: pip install more-itertools The recipes from the itertools docs are included in the top-level package: >>> from more_itertools import flatten >>> iterable = [(0, 1), (2, 3)] >>> list(flatten(iterable)) [0, 1, 2, 3] Several new recipes are available as well: >>> from more_itertools import chunked >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8] >>> list(chunked(iterable, 3)) [[0, 1, 2], [3, 4, 5], [6, 7, 8]] >>> from more_itertools import spy >>> iterable = (x * x for x in range(1, 6)) >>> head, iterable = spy(iterable, n=3) >>> list(head) [1, 4, 9] >>> list(iterable) [1, 4, 9, 16, 25] For the full listing of functions, see the API documentation. Links elsewhere Blog posts about more-itertools: * Yo, I heard you like decorators * Tour of Python Itertools (Alternate) * Real-World Python More Itertools Development more-itertools is maintained by @erikrose and @bbayles, with help from many others. If you have a problem or suggestion, please file a bug or pull request in this repository. Thanks for contributing! Version History The version history can be found in documentation. Contents * API Reference + Grouping + Lookahead and lookback + Windowing + Augmenting + Combining + Summarizing + Selecting + Combinatorics + Wrapping + Others * License * Testing * Version History Next --------------------------------------------------------------------- (c) Copyright 2012, Erik Rose. Revision 1e0e6621. Built with Sphinx using a theme provided by Read the Docs. Read the Docs v: stable Versions latest stable v10.2.0 v10.1.0 v10.0.1 v10.0.0 v9.1.1 v9.1.0 v9.0.0 v8.14.0 v8.13.0 v8.12.0 v8.11.2 v8.11.1 v8.11.0 v8.10.0 v8.9.0 v8.8.0 v8.7.0 v8.6.0 8.5.0 v8.4.0 v8.3.0 v8.2.0 v7.2.0 6.0.0 5.0.0 4.3.1 3.2.0 2.6.0 version-8.14.0 version-8.13.0 version-10.2.0 test-docs-fix rtd-v2 Downloads On Read the Docs Project Home Builds