Monday, January 7, 2019

Christian Barra: Python dictionary views

Did you know that "dict.keys()" returns a view that is a set-like object? #Python pic.twitter.com/0zS9FgnkLL — Christian Barra (@christianbarra) July 31, 2018 Dictionary is one of the Python’s greatest features and using the keys(), items() and values() methods is really common. first_dictionary = {"a": 1, "b": 2} for key, value in first_dictionary.items(): print(f"Key {key} with value {value}") # Key a with value 1 # Key b with value 2 But do you know which kind of object is returned?

from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...