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 Find Hash of File
Python Program to Find the Sum of Natural Numbers
Python List append()
Python callable()
Python Program to Find the Factorial of a Number
Python Program to Compute all the Permutation of the String
Python Program to Create Pyramid Patterns
Python Program to Calculate the Area of a Triangle
Python String format_map()
Python open()
Python Program to Find the Size (Resolution) of a Image
Python Set discard()
Python String islower()
Python Matrices and NumPy Arrays
Python ord()
Python abs()
Python RegEx
Node.js vs Python for Backend Development
Python Objects and Classes
Python Dictionary keys()
Python Machine Learning Cookbook - Practical solutions from preprocessing to Deep Learning - Chris A...
Python setattr()
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python dict()
Python Program to Get the Class Name of an Instance
Python Program to Merge Two Dictionaries
Python property()
Python Artificial Intelligence Project for Beginners - Joshua Eckroth
Python Tuple count()
Python Data Structures and Algorithms - Benjamin Baka
Python for Programmers with introductory AI case studies - Paul Deitel & Harvey Deitel
How to get current date and time in Python?