Using decode()
print(b'Easy \xE2\x9C\x85'.decode("utf-8"))
Output
Easy ✅
Using decode()
, you can convert bytes into string. Here, we have used utf-8 for decoding. \xE2\x9C\x85
is the utf-8 code for ✅.
Also Read:
Become a certified Python
programmer.
Created with over a decade of experience.
Created with over a decade of experience and thousands of feedback.
Become a certified Python
programmer.
To understand this example, you should have the knowledge of the following Python programming topics:
print(b'Easy \xE2\x9C\x85'.decode("utf-8"))
Output
Easy ✅
Using decode()
, you can convert bytes into string. Here, we have used utf-8 for decoding. \xE2\x9C\x85
is the utf-8 code for ✅.
Also Read:
Your builder path starts here. Builders don't just know how to code, they create solutions that matter.
Escape tutorial hell and ship real projects.
Try Programiz PRO