Printing emojisπŸ˜πŸŽ‰πŸ˜›πŸ˜›πŸ˜ in python 🐍🐍

Have you ever thought of inserting emojis into your python program? Well, if you haven't, you should start thinking of inserting one into some of your mini projects to make it fun😜.
Emojis are now everywhere, even in programming now.
In python now, there are three ways you could insert an emoji.
  • You could use unicodes
  • The Common Locale Data Repository(CLDR) names
  • The emoji module
  • Using the unicodes
    Every emoji we use when chatting all have unicodes and we can use these unicodes in python to output these same emoji.
    Codes
    # face with tears of joy
    print("\U0001f602")
    
    # face with tongue
    print("\U0001f61b")
    Output
    πŸ˜‚
    πŸ˜›
    For the full emoji list, visit Link
    Replace the "+" with "000". So "U+1F602" becomes "U0001F602".
    Using CLDR names
    Emojis also have CLDR short names. All the short names are provided in the link above.
    Code
    # face with tears of joy
    print("\N{face with tears of joy}")
    
    # face with tongue
    print("\N{face with tongue}")
    Output
    πŸ˜‚
    πŸ˜›
    Using the emoji module
    To install the module, run pip install emoji in your terminal.
    We will use the CLDR short names here by using the emojize() function. All spaces the the CLDR short names would be replaced by an underscore.
    Code
    # Import the module
    import emoji
    
    print(emoji.emojize("Python is :thumbs_up:")
    print(emoji.emojize("I :red_heart: python")
    Output
    Python is πŸ‘
    I ❀️ python

    42

    This website collects cookies to deliver better user experience

    Printing emojisπŸ˜πŸŽ‰πŸ˜›πŸ˜›πŸ˜ in python 🐍🐍