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 Trim Whitespace From a String
Python Set issuperset()
Python Keywords and Identifiers
Python Type Conversion and Type Casting
Python Program to Get the Last Element of the List
Convert Hex to ASCII in Java
Python Program to Sort Words in Alphabetic Order
Python enumerate()
Python Program to Make a Flattened List from Nested List
Python @property decorator
How to get current date and time in Python?
Python ascii()
Python *args and **kwargs
Python Set copy()
Python Set update()
Python Program to Access Index of a List Using for Loop
How to Convert List to Map in Java
Convert Character Array to String in Java
Python sorted()
Python Dictionary items()
Python Dictionary copy()
Python list()
Python Program to Create a Countdown Timer
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python next()
Python timestamp to datetime and vice-versa
Python set()
Python reversed()
Python String lower()
Python String rsplit()
Python bool()
Python Program to Find LCM