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 Generators
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Program to Add Two Numbers
Python for Loop
Convert Time to Milliseconds in Java
Python hex()
Python List extend()
Python Data Types
Convert a Map to an Array, List or Set in Java
Python String rindex()
Python Tuple count()
Python set()
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Python delattr()
Python Program to Display the multiplication Table
Python Program to Safely Create a Nested Directory
Python bool()
Python Program to Convert String to Datetime
Python Program to Count the Number of Occurrence of a Character in String
Python Inheritance
Python print()
Python Program to Find ASCII Value of Character
Python Program to Find the Size (Resolution) of a Image
Python Iterators
Python Program to Display Powers of 2 Using Anonymous Function
Python String isdigit()
Python Tuple index()
Python String format()
Python Machine Learning Eqution Reference - Sebastian Raschka
Python callable()
Python break and continue
Python Program to Compute the Power of a Number