Skip to content

Instantly share code, notes, and snippets.

@altela
Last active May 7, 2022 02:34
Show Gist options
  • Save altela/8cb3195c00d315c19c55b25da517070c to your computer and use it in GitHub Desktop.
Save altela/8cb3195c00d315c19c55b25da517070c to your computer and use it in GitHub Desktop.
Find Record in Dictionary Using a List
lower_case = "thequickfoxjumpedoverthelazydog"
# Created a new dictionary
lexicon = {
"a": "61",
"b": "62",
"c": "63",
"d": "64",
"e": "65",
"f": "66",
"g": "67",
"h": "68",
"i": "69",
"j": "6a",
"k": "6b",
"l": "6c",
"m": "6d",
"n": "6e",
"o": "6f",
"p": "70",
"q": "71",
"r": "72",
"s": "73",
"t": "74",
"u": "75",
"v": "76",
"w": "77",
"x": "78",
"y": "79",
"z": "7a",
}
# Find record from dictionary based on split
convert_to_utf8 = list(map(lexicon.get, lower_case))
print(convert_to_utf8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment