Flatten nested iterable object for Python (Pure-Python implementation)
MIT License
|travis| |coveralls| |pyversion| |version| |license|
Flatten nested iterable object (Pure-Python implementation)
Japanese document is available: https://qiita.com/yukinoi/items/9570c76034c28bdae0a8
::
$ pip install flati
.. code:: python
import flati
iterable = [(1, 2, 3), (4, (5, 6))] list(flati.flatten(iterable))
import types isinstance(flati.flatten(iterable), types.GeneratorType)
iterable = [('abc'), ('def', ('g', 'hi'))] list(flati.flatten(iterable, ignore=str))
If you want to flatten numpy.ndarray, I recommend using following methods:
Contributions are welcome.
See https://github.com/ikegami-yukino/flati/blob/master/CONTRIBUTING.md
.. |travis| image:: https://travis-ci.org/ikegami-yukino/flati.svg?branch=master :target: https://travis-ci.org/ikegami-yukino/flati :alt: travis-ci.org
.. |coveralls| image:: https://coveralls.io/repos/ikegami-yukino/flati/badge.svg?branch=master&service=github :target: https://coveralls.io/github/ikegami-yukino/flati?branch=master :alt: coveralls.io
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/flati.svg
.. |version| image:: https://img.shields.io/pypi/v/flati.svg :target: http://pypi.python.org/pypi/flati/ :alt: latest version
.. |license| image:: https://img.shields.io/pypi/l/flati.svg :target: http://pypi.python.org/pypi/flati/ :alt: license