how to print dict object in python code example
Example 1: python print dictionary line by line
# Iterate over key/value pairs in dict and print them
for key, value in student_score.items():
print(key, ' : ', value)
Example 2: dictionary in python
d = {'key1':'value1','key2':'value2'}
print(d) # to print full dictionary
l=d.keys
print(l) # to print keys
b=d.values
print(b)#to print values in dictionary
Example 3: dictionary in python
# Dictionaries in Python
ages = {"John": 43, "Bob": 24, "Ruth": 76} # Marked by { at beginning and a } at end
# ^^^ Has sets of keys and values, like the 'John' and 43 set. These two values must be seperated by a colon
# ^^^ Sets of values seperated by commas.