Loop over dictionary keys


Looping over the "dictionary" is just like looping over the keys, but personally I prefer when we use the somedictionary.keys() expression.


examples/dictionary/loop_dictionary.py
user = {
    'fname': 'Foo',
    'lname': 'Bar',
}

for key in user:
    print(f"{key} -> {user[key]}")

# lname -> Bar
# fname -> Foo