{"id":25044,"date":"2021-11-10T09:37:10","date_gmt":"2021-11-10T04:07:10","guid":{"rendered":"https:\/\/python-programs.com\/?p=25044"},"modified":"2021-11-10T09:37:10","modified_gmt":"2021-11-10T04:07:10","slug":"python-dictionary-values-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-dictionary-values-function-with-examples\/","title":{"rendered":"Python Dictionary values() Function with Examples"},"content":{"rendered":"

Dictionary values() Function in Python:<\/strong><\/p>\n

The values() method returns a view object that displays a list of all the dictionary’s values.<\/p>\n

Syntax:<\/strong><\/p>\n

dictionary.values()<\/pre>\n

Parameters:<\/strong>\u00a0This method doesn\u2019t accept any parameters<\/p>\n

Return Value:<\/strong><\/p>\n

The values() method returns a view object containing a list of all values in a given dictionary.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given dictionary = {20: 'good', 30: 'morning', 40: 'btechgeeks'}<\/pre>\n

Output:<\/strong><\/p>\n

The values of the given dictionary is:\r\ndict_values(['good', 'morning', 'btechgeeks'])<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given dictionary = {'hello': 1, 'this': 3, 'is': 4, 'btechgeeks': 8}<\/pre>\n

Output:<\/strong><\/p>\n

The values of the given dictionary is:\r\ndict_values([1, 3, 4, 8])<\/pre>\n

Dictionary values() Function with Examples in Python<\/h2>\n