print python emoji as unicode string

前端 未结 6 1928
谎友^
谎友^ 2020-12-03 13:48

I\'ve been trying to output \"\" as \'\\U0001f604\' instead of the smiley but it doesn\'t seem to work.

i tried

6条回答
  •  天涯浪人
    2020-12-03 14:39

    This code might help you to see how you can simply print an emoji:

    Code

    # -*- coding: UTF-8 -*-
    import re
    
    # string = 'Anything else that you wish to match, except URLs http://url.org'
    string = 'Anything else that you wish to match'
    matches = re.search(r'^(((?!http|https).)+)$', string)
    if matches:
        print(matches.group(1)+ " is a match 

提交回复
热议问题