How to extract all the emojis from text?
问题 Consider the following list: a_list = ['🤔 🙈 me así, bla es se 😌 ds 💕👭👙'] How can I extract in a new list all the emojis inside a_list ?: new_lis = ['🤔 🙈 😌 💕 👭 👙'] I tried to use regex, but I do not have all the possible emojis encodings. 回答1: You can use the emoji library. You can check if a single codepoint is an emoji codepoint by checking if it is contained in emoji.UNICODE_EMOJI . import emoji def extract_emojis(str): return ''.join(c for c in str if c in emoji.UNICODE_EMOJI) 回答2: I think