项目作者: ivanleoncz

项目描述 :
Insights from Tuples and Lists, using Comprehensions.
高级语言: Python
项目地址: git://github.com/ivanleoncz/tulian.git
创建时间: 2018-04-07T22:29:59Z
项目社区:https://github.com/ivanleoncz/tulian

开源协议:GNU General Public License v3.0

下载


Tulian

Insights from Tuples and Lists, using Comprehensions.

Tulian provides a summary (JSON) of data types contained in a Tuple or in a List.

  1. >>> from tulian import main
  2. >>>
  3. >>> data = main.Tulian()
  4. >>>
  5. >>> l = ['Python', 'Node.js', 2018, 3.14, [20, 20.2, 56.4, 86, 76.3, 22], (10, 100, 1000, 10000), 1988]
  6. >>>
  7. >>> print(data.summary(l))
  8. {
  9. "lists": 1,
  10. "float": 2,
  11. "tuples": 1,
  12. "int": 2,
  13. "str": 2
  14. }

It also provides the extraction/presentation of a specific data type.

  1. >>> data.ints(l)
  2. [2018, 1988]
  3. >>>
  4. >>> data.strs(l)
  5. ['Python', 'Node.js']
  6. >>>
  7. >>> data.tuples(l)
  8. [(10, 100, 1000, 10000)]

For obtaining information of nested Tuples and Lists, the positional argument must be passed:

  1. >>> print(data.summary(l[4]))
  2. {
  3. "float": 3,
  4. "int": 3
  5. }