320
321 final_str = ""
322 for char in text:
323 if char in MEMES.REPLACEMENT_MAP.keys():324 new_char = MEMES.REPLACEMENT_MAP[char]
325 else:
326 new_char = char
63 # Key will be group name
64 # values will be dict of dicts of key command and value description
65
66 if module_name in CMD_HELP.keys():67 command_dict = CMD_HELP[module_name]
68 else:
69 command_dict = {}
Consider iterating the dictionary directly instead of calling .keys()
.
Using for key in dictionary
would always iterate the dictionary keys.
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds.keys():
print(key)
sounds = {"cow": "moo", "dog": "bark"}
for key in sounds:
print(key)