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 Dictionary values()
Debug a JavaMail Program
Python filter()
Python String isalnum()
Python String islower()
Python Program to Check If a String Is a Number (Float)
Python enumerate()
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python List index()
Python Program to Find the Factorial of a Number
Python String rpartition()
Python Inheritance
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python List
Python Program to Create Pyramid Patterns
Python List sort()
Python Program to Find the Factors of a Number
Python strptime()
Python Machine Learning Eqution Reference - Sebastian Raschka
Python String expandtabs()
Python Program to Remove Punctuations From a String
Python Program to Concatenate Two Lists
Python Dictionary update()
Python Decorators
Python dir()
Python String ljust()
Python Program to Randomly Select an Element From the List
Python float()
Python reversed()
Python Program to Convert Two Lists Into a Dictionary
Python type()
Python Type Conversion and Type Casting