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 Variables, Constants and Literals
Python Program to Make a Flattened List from Nested List
Python if...else Statement
Python String isnumeric()
Deep Learning with Python - Francois Cholletf
Python List Comprehension
Python List append()
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python ascii()
Python Program to Convert Celsius To Fahrenheit
Python Matrices and NumPy Arrays
Convert Hex to ASCII in Java
Java Program to Implement the Program Used in grep/egrep/fgrep
Python String center()
Python Program to Randomly Select an Element From the List
Python enumerate()
Python Program to Print all Prime Numbers in an Interval
Python Program to Display Calendar
Python String casefold()
Python globals()
Python Program to Check if a Key is Already Present in a Dictionary
Python List
Python Type Conversion and Type Casting
Python Program to Find Armstrong Number in an Interval
Python Set issuperset()
Python Program to Get the File Name From the File Path
Python Iterators
Python Set remove()
Python Set issubset()
Python Set clear()
Python Program to Get the Full Path of the Current Working Directory
Python @property decorator