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 Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Program to Check If a List is Empty
Python Program to Get the File Name From the File Path
Python String index()
Python for Loop
Python List clear()
Python Set update()
Python List pop()
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python Program to Find ASCII Value of Character
Python Program to Find Numbers Divisible by Another Number
Convert a Map to an Array, List or Set in Java
Python Program to Find the Factorial of a Number
Python Program to Sort a Dictionary by Value
Python Program to Find the Factors of a Number
Python Dictionary setdefault()
Python Tuple
Python bool()
Python Program to Check If a String Is a Number (Float)
Python Program to Add Two Numbers
Python Keywords and Identifiers
Deep Learning in Python - LazyProgrammer
Python dir()
Convert Time to Milliseconds in Java
Python String translate()
Python Program to Transpose a Matrix
Python Set intersection()
Python String count()
Python List copy()
Python Set union()
Python round()
Python Dictionary values()