Skip to content

Instantly share code, notes, and snippets.

@Glutexo
Created September 9, 2022 10:24
Show Gist options
  • Save Glutexo/2ca8ffd15d3f0c0622c327866d397fa5 to your computer and use it in GitHub Desktop.
Save Glutexo/2ca8ffd15d3f0c0622c327866d397fa5 to your computer and use it in GitHub Desktop.
__getitem__ example
from unicodedata import name
ANIMALS = (
"๐Ÿถ๐Ÿฑ๐Ÿญ๐Ÿน๐Ÿฐ๐ŸฆŠ๐Ÿป๐Ÿผ๐Ÿป๐Ÿจ๐Ÿฏ๐Ÿฆ๐Ÿฎ๐Ÿท๐Ÿฝ๐Ÿธ๐Ÿต๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ’๐Ÿ”๐Ÿง๐Ÿฆ๐Ÿค๐Ÿฃ๐Ÿฅ๐Ÿฆ†๐Ÿฆ…๐Ÿฆ‰๐Ÿฆ‡๐Ÿบ๐Ÿ—๐Ÿด๐Ÿฆ„๐Ÿ๐Ÿชฑ๐Ÿ›๐Ÿฆ‹๐ŸŒ๐Ÿž๐Ÿœ๐Ÿชฐ๐Ÿชฒ๐Ÿชณ๐ŸฆŸ๐Ÿฆ—๐Ÿ•ท๐Ÿ•ธ๐Ÿฆ‚๐Ÿข๐Ÿ๐ŸฆŽ๐Ÿฆ–๐Ÿฆ•๐Ÿ™๐Ÿฆ‘๐Ÿฆ๐Ÿฆž๐Ÿฆ€๐Ÿก๐Ÿ ๐ŸŸ๐Ÿฌ๐Ÿณ๐Ÿ‹๐Ÿฆˆ๐Ÿฆญ๐ŸŠ"
"๐Ÿ…๐Ÿ†๐Ÿฆ“๐Ÿฆ๐Ÿฆง๐Ÿฆฃ๐Ÿ˜๐Ÿฆ›๐Ÿฆ๐Ÿช๐Ÿซ๐Ÿฆ’๐Ÿฆ˜๐Ÿฆฌ๐Ÿƒ๐Ÿ‚๐Ÿ„๐ŸŽ๐Ÿ–๐Ÿ๐Ÿ‘๐Ÿฆ™๐Ÿ๐ŸฆŒ๐Ÿ•๐Ÿฉ๐Ÿฆฎ๐Ÿˆ๐Ÿชถ๐Ÿ“๐Ÿฆƒ๐Ÿฆค๐Ÿฆš๐Ÿฆœ๐Ÿฆข๐Ÿฆฉ๐Ÿ•Š๐Ÿ‡๐Ÿฆ๐Ÿฆจ๐Ÿฆก๐Ÿฆซ๐Ÿฆฆ๐Ÿฆฅ๐Ÿ๐Ÿ€๐Ÿฟ๐Ÿฆ”๐Ÿพ๐Ÿ‰๐Ÿฒ"
)
class Emoticons:
def __init__(self, chars):
self.chars = chars
def __getitem__(self, item):
return [char for char in self.chars if item in name(char)]
if __name__ == "__main__":
animals = Emoticons(ANIMALS)
print(animals["MOUSE"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment