YouTip LogoYouTip

Python3 Att Dictionary Items

# Python3.x Python3 Dictionary items() Method [![Image 3: Python3 Dictionary](#) Python3 Dictionary](#) * * * ## Description The Python dictionary `items()` method returns a view object that contains a list of the dictionary's key/value pairs as tuples, which is iterable. The view objects returned by [dict.keys()](#), [dict.values()](#), and `dict.items()` provide a dynamic view of the dictionary's contents. This means that if the dictionary changes, the view reflects those changes. View objects are not lists and do not support indexing. You can convert them to a list using `list()`. We cannot modify the view objects in any way, as the dictionary view objects are read-only. ## Syntax The `items()` method syntax: dict.items() ## Parameters * NA. ## Return Value Returns a view object. ## Example The following example demonstrates the usage of the `items()` method: ## Example #!/usr/bin/python3 tinydict = {'Name': 'Tutorial', 'Age': 7} print("Value : %s" % tinydict.items()) The output of the above example is: Value : dict_items([('Age', 7), ('Name', 'Tutorial')]) * * Python3 Dictionary](#)
← Python3 Att Dictionary SetdefaPython3 Att Dictionary Items β†’