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 Remove Duplicate Element From a List
Python set()
Python Namespace and Scope
Python map()
Python datetime
Python divmod()
Python __import__()
Python String center()
Python Program to Make a Flattened List from Nested List
Python Operator Overloading
Python Program to Check Armstrong Number
Python String index()
Python Program to Print Colored Text to the Terminal
Python Program to Check Prime Number
Python Data Types
Python Program to Sort Words in Alphabetic Order
Python reversed()
Python Program to Display Calendar
Python List copy()
Python Program to Illustrate Different Set Operations
Python frozenset()
Convert String to Byte Array and Reverse in Java
Python String isdigit()
Python Program to Convert Celsius To Fahrenheit
Python Data Structures and Algorithms - Benjamin Baka
Python Program to Check If a List is Empty
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
Python Set difference()
Python print()
Python String format()
Python Program to Randomly Select an Element From the List
Python Program to Get the Class Name of an Instance