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 Matrices and NumPy Arrays
Python Program to Check Prime Number
Python __import__()
Convert a Map to an Array, List or Set in Java
Python dir()
Python String replace()
Python Set add()
Python List Comprehension
Python @property decorator
Python Program to Convert Kilometers to Miles
Python Iterators
Python Program to Find the Factors of a Number
Python Namespace and Scope
Deep Learning in Python - LazyProgrammer
Python Program to Calculate the Area of a Triangle
Python any()
Python Dictionary keys()
Python Program to Count the Number of Occurrence of a Character in String
Python help()
Python Program to Check if a Number is Positive, Negative or 0
Python sum()
Python String index()
Python iter()
Python delattr()
Python locals()
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Dictionary popitem()
Python String partition()
Python Program to Find the Size (Resolution) of a Image
Python Program to Get File Creation and Modification Date
Python Program to Catch Multiple Exceptions in One Line
Python Directory and Files Management