Python Program to Convert Bytes to a String

To understand this example, you should have the knowledge of the following Python programming topics:


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:

Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges