Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # first lets create an associative array (or dictionary as its called in python)
- a = {10 : 'cat', 20 : 'bird'}
- # the dictionary 'a' has a method called keys() which returns all its keys
- # and since we're interested in the first (with index 0) we'll get it through:
- print a.keys()[0]
- # result: 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement