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 String ljust()
Python exec()
Python Program to Multiply Two Matrices
Python List copy()
Python Program to Copy a File
Python Program to Extract Extension From the File Name
Python File I/O Operation
Python String lower()
Deep Learning with Applications Using Python - Navin Kumar Manaswi
Python bool()
Python List sort()
Python set()
Python if...else Statement
Python Program to Differentiate Between type() and isinstance()
Python Dictionary values()
Python Program to Count the Occurrence of an Item in a List
Python Program to Find Numbers Divisible by Another Number
Python Program to Count the Number of Each Vowel
Python Program to Display Powers of 2 Using Anonymous Function
Python Program to Differentiate Between del, remove, and pop on a List
Python String rjust()
Python String capitalize()
Python Machine Learning Third Edition - Sebastian Raschka & Vahid Mirjalili
Python tuple()
Building Chatbots with Python Using Natural Language Processing and Machine Learning - Sumit Raj
Python String isprintable()
Python Program to Merge Two Dictionaries
Python Program to Check If Two Strings are Anagram
Python Set update()
Python Custom Exceptions
Python Set symmetric_difference_update()
Python Program to Shuffle Deck of Cards