In Python, a Map
is generally referred to as a Dictionary
. You can find the keys of a dictionary in Python using the keys()
function.
Here's an example:
main.py157 chars9 lines
This will output:
main.py41 chars2 lines
You can then iterate over the keys and print their values:
main.py88 chars4 lines
This will output:
main.py6 chars4 lines
Alternatively, you can also convert the keys to a list using list()
function.
main.py95 chars6 lines
This will output:
main.py30 chars2 lines
gistlibby LogSnag