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 Convert Decimal to Binary Using Recursion
Python del Statement
Python Program to Differentiate Between type() and isinstance()
Python Program to Find the Factorial of a Number
Convert Time to Milliseconds in Java
Python Data Structures and Algorithms - Benjamin Baka
Python String split()
Python List copy()
Python Dictionary popitem()
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python sum()
Python List append()
Python Function Arguments
Python frozenset()
Python String lstrip()
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Dictionary fromkeys()
Python Program to Swap Two Variables
Introduction to Scientific Programming with Python - Joakim Sundnes
Python Program to Concatenate Two Lists
Python String format_map()
Python String upper()
Python String swapcase()
Python Program to Safely Create a Nested Directory
Convert String to Byte Array and Reverse in Java
Python Modules
Python Program to Check if a Number is Odd or Even
Python String isspace()
Python range()
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Python Program to Merge Two Dictionaries