Python package for flatting of list or tuple.
Project description
Flatway
Easily flat the lists and tuples in your python project.
How to use?
- install package using
pip install flatway
- import package in your project.
from flatway.flatten import flatten
myList = [1,2,3,[4,5,6,[7,8,9,[10,11]]]]
depth = 3 # default to 1
flatList = flatten(myList , depth)
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
myTuple = (1,2,3,(4,5,6,(7,8,9,(10,11))))
flatTuple = flatten(myTuple, depth)
# (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
deepOne = flatten(myList)
# [1, 2, 3, 4, 5, 6, [7, 8, 9, [10, 11]]]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flatway-1.0.0.tar.gz
(3.1 kB
view hashes)