{"action":"created","issue":{"url":"https://api.github.com/repos/maggienj/ActiveData/issues/21","repository_url":"https://api.github.com/repos/maggienj/ActiveData","labels_url":"https://api.github.com/repos/maggienj/ActiveData/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/maggienj/ActiveData/issues/21/comments","events_url":"https://api.github.com/repos/maggienj/ActiveData/issues/21/events","html_url":"https://github.com/maggienj/ActiveData/issues/21","id":234338380,"number":21,"title":"For journal entry: Key values - in dict","user":{"login":"maggienj","id":16616569,"avatar_url":"https://avatars3.githubusercontent.com/u/16616569?v=3","gravatar_id":"","url":"https://api.github.com/users/maggienj","html_url":"https://github.com/maggienj","followers_url":"https://api.github.com/users/maggienj/followers","following_url":"https://api.github.com/users/maggienj/following{/other_user}","gists_url":"https://api.github.com/users/maggienj/gists{/gist_id}","starred_url":"https://api.github.com/users/maggienj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggienj/subscriptions","organizations_url":"https://api.github.com/users/maggienj/orgs","repos_url":"https://api.github.com/users/maggienj/repos","events_url":"https://api.github.com/users/maggienj/events{/privacy}","received_events_url":"https://api.github.com/users/maggienj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-06-07T20:51:20Z","updated_at":"2017-06-12T16:27:59Z","closed_at":null,"body":"For journal entry:\r\n\r\n```\r\nmydict = {'george':16,'amber':19}\r\nprint mydict.keys()[mydict.values().index(16)] # Prints george\r\n```\r\n\r\nOr in Python 3.x:\r\n\r\n```\r\nmydict = {'george':16,'amber':19}\r\nprint(list(mydict.keys())[list(mydict.values()).index(16)]) # Prints george\r\n```\r\n\r\nBasically, it separates the dictionary's values in a list, finds the position of the value you have, and gets the key at that position.\r\n\r\nMore about keys() and .values() in Python 3: Python: simplest way to get list of values from dict?\r\n\r\nThis could be used only if you are passing the value and fetching the key name.\r\n\r\nBecause, this doesn't loop through in the \"for loop\" and fetches the keyname for that index value.\r\n\r\nMarking it here to remember as this is something interesting to look at... as it appears to be \"missing the looping in a for loop\" and gets to the index value straight. \r\nNot sure , how the internal works in python for this to not to loop and get straight to the index.\r\nFor now, wanted to mark this here, so that I can lookup later on to remember these specialties in Python.\r\n\r\nRef: As I was googling for something last week, this article popped up, so storing it here for future reference.\r\nhttps://stackoverflow.com/questions/8023306/get-key-by-value-in-dictionary\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/maggienj/ActiveData/issues/comments/307842578","html_url":"https://github.com/maggienj/ActiveData/issues/21#issuecomment-307842578","issue_url":"https://api.github.com/repos/maggienj/ActiveData/issues/21","id":307842578,"user":{"login":"klahnakoski","id":2334429,"avatar_url":"https://avatars0.githubusercontent.com/u/2334429?v=3","gravatar_id":"","url":"https://api.github.com/users/klahnakoski","html_url":"https://github.com/klahnakoski","followers_url":"https://api.github.com/users/klahnakoski/followers","following_url":"https://api.github.com/users/klahnakoski/following{/other_user}","gists_url":"https://api.github.com/users/klahnakoski/gists{/gist_id}","starred_url":"https://api.github.com/users/klahnakoski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klahnakoski/subscriptions","organizations_url":"https://api.github.com/users/klahnakoski/orgs","repos_url":"https://api.github.com/users/klahnakoski/repos","events_url":"https://api.github.com/users/klahnakoski/events{/privacy}","received_events_url":"https://api.github.com/users/klahnakoski/received_events","type":"User","site_admin":false},"created_at":"2017-06-12T16:27:59Z","updated_at":"2017-06-12T16:27:59Z","body":"I think we are done with this issue.  Please close."}}
{"actor":{"display_login":"klahnakoski"}}