In this example, you will learn 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 ✅.
Related posts:
Python Program to Catch Multiple Exceptions in One Line
Python Program to Check Whether a String is Palindrome or Not
Python super()
Python Tuple
Deep Learning with Python - Francois Chollet
Python Set remove()
Python String isupper()
Python String istitle()
Python open()
Python String swapcase()
Python String index()
Python Dictionary get()
Python Program to Get a Substring of a String
Python Program to Find Numbers Divisible by Another Number
Python for Loop
Python Recursion
Python Machine Learning Eqution Reference - Sebastian Raschka
Python String isspace()
Python String islower()
Python Program to Find the Largest Among Three Numbers
Python String zfill()
Python all()
Python Deep Learning Cookbook - Indra den Bakker
Python Program to Get Line Count of a File
Python Program to Remove Punctuations From a String
Python Program to Reverse a Number
Python Tuple count()
Python List remove()
Python Program to Safely Create a Nested Directory
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python String isdigit()
Python Program to Represent enum