values_view = my_dict.values() returns a dynamic view of the dictionary values. The view is linked to the original dictionary and reflects later changes.
See the complete Dictionary Methods table for the other dictionary operations in this cluster.
my_dict={'a':'One','b':'Two','c':'Three'}
x=my_dict.values()
print(x)
Output is here
dict_values(['One', 'Two', 'Three'])
my_dict={'a':'One','b':'Two','c':'Three'}
x=my_dict.values()
print(x)
my_dict.update({'c':'New Value'})
print(x)
Output (2nd print(x) reflects the changes )
dict_values(['One', 'Two', 'Three'])
dict_values(['One', 'Two', 'New Value'])
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.