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 issubclass()
Python Machine Learning Third Edition - Sebastian Raschka & Vahid Mirjalili
Python Program to Find HCF or GCD
Python eval()
Python List insert()
Python Dictionary clear()
Python delattr()
Python List extend()
Python String lstrip()
Python Program to Calculate the Area of a Triangle
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Java Program to Convert a Decimal Number to Binary Number using Stacks
Python Dictionary get()
Python hex()
Python Program to Merge Two Dictionaries
Python String rsplit()
Python Inheritance
Python Dictionary copy()
Python Program to Convert Decimal to Binary Using Recursion
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python __import__()
Python ascii()
Python frozenset()
Python max()
Python timestamp to datetime and vice-versa
Python object()
Python Program to Count the Number of Digits Present In a Number
Python reversed()
Python Tuple index()
Python Program to Check Whether a String is Palindrome or Not
Python String count()
Python staticmethod()