Python Dictionary values() Method

Example

Return Value:

car = {
  "brand": "Porsche",
  "model": "911",
  "year": 1963
}
x = car.values()
print(x)

Run Instance

Definition and Usage

The values() method returns a view object. This view object contains a list of dictionary values.

This view object will reflect any changes made to the dictionary. Please see the following example.

Syntax

dictionary.values()

Parameter Value

No Parameters

More Examples

Example

When the value of the dictionary changes, the view object will also be updated:

car = {
  "brand": "Porsche",
  "model": "911",
  "year": 1963
}
x = car.values()
car["year"] = 2018
print(x)

Run Instance