Python Built-ins

Quite a few handy functions

Comprehensions

  • Dictionary comprehensions supported since 2.7
>>> items = [['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]]

>>> {a[0]: a[1] for a in items}

{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}

List comprehensions

Python Built-ins

By Joe Meilinger

Python Built-ins

  • 199