0

Im having trouble concatenating these Unicode emojis with strings in Python3 (to send in Pushwoosh notifications).

Im defining emojis as Unicode variables:

stick_out_tongue = u'U+1F61C'

And then concatenating the string as such:

message = ' Message here...'
message = stick_out_tongue + message

But the output looks turns out like :

'U+1F61C Message here...'

Plz hlp.

redress
  • 1,399
  • 4
  • 20
  • 34
  • 1
    That's just a string with 'U', '+', etc. You're probably after `'\U0001f61c'`. – lenz Mar 05 '20 at 23:02
  • What is the error you are getting? – Valentyn Mar 05 '20 at 23:02
  • I'm sure this question has been asked before, one way or another, but I can't find a proper duplicate right now. [This thread](https://stackoverflow.com/questions/47716217) is related, though. – lenz Mar 05 '20 at 23:08

1 Answers1

1

Like @lenz said, you are probably looking for "\U0001f61c." That is a specific unicode character code. When you write "u'U+1F61C'" it simply takes the text "U+1F61C" and encodes it in unicode characters. You specify a unicode character code (as apposed to unicode text) by using a "\U." See this tutorial for more information.

Catogram
  • 303
  • 1
  • 12