I have prepared a chatbot using tkinter python. I want to display the emoji after every message. How to concatenate string and emoji in chatbot? The problem doesn't arise if I use a normal string. For example, I have tried this -
import codecs
x = 'Hello \\U0001F600 world'
codecs.decode(x, 'unicode_escape')
Output
'Hello world'
But when I implement the same in a chatbot it's giving - code -
face = '\\U0001F600'
face_decode = codecs.decode(face, 'unicode-escape')
def send():
msg = EntryBox.get("1.0",'end-1c').strip()
EntryBox.delete("0.0",END)
if msg != '':
ChatLog.config(state = NORMAL)
ChatLog.insert(END, "You: " + msg + '\n\n', )
ChatLog.config(font = ("Arial", 14, 'bold'))
res = chatbot_response(msg)
ChatLog.insert(END, "Tanya: " + res + face + '\n\n')
Here msg and res are the strings. I am getting the following output
How to overcome this?