Messages
4/8/2020
2 : 6
[🐍PyTricks]: How to sort a Python dict by value
# How to sort a Python dict by value # (== get a representation sorted by value) >>> xs = {'a': 4, 'b': 3, 'c': 2, 'd': 1} >>> sorted(xs.items(), key=
4/7/2020
3 : 37
[🐍PyTricks]: Merging two dicts in Python 3.5+ with a single expression
# How to merge two dictionaries # in Python 3.5+ >>> x = {'a': 1, 'b': 2} >>> y = {'b': 3, 'c': 4} >>> z = {**x, **y} >>> z {'c
4/7/2020
3 : 37
Python 4.0
Hey Reader, The coding world is moving FAST and without pause. So here's a quick tip for staying up to date with the latest Python developments: PyCoder's Weekly is a free, once-weekly email
4/7/2020
3 : 36
[🐍PyTricks]: Different ways to test multiple flags at once in Python
# Different ways to test multiple # flags at once in Python x, y, z = 0, 1, 0 if x == 1 or y == 1 or z == 1: print('passed') if 1 in (x, y, z): print('passed') # These only test for