Emoji converter

Question:

How can I convert this string in python3 ' ' into this '%F0%9F%91%80%F0%9F%A5%B6' ? Would like to do this with any emojis

Asked By: rdy4sv

||

Answers:

If percentage encoding is what you are after, urllib module in Python could help.

Ref: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote

Python 3:

text = ' '
import urllib.parse
print(urllib.parse.quote(text))

Returns

%F0%9F%91%80%F0%9F%A5%B6
Answered By: Abhilash
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.