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 Print Colored Text to the Terminal
Python type()
Python next()
Python String isalnum()
Python List Comprehension
Java Program to Convert a Decimal Number to Binary Number using Stacks
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Python String istitle()
Python Program to Safely Create a Nested Directory
Python exec()
Python Dictionary
Python Program to Measure the Elapsed Time in Python
Python help()
Python Program to Find the Factorial of a Number
Python Program to Print Output Without a Newline
Python frozenset()
Python Objects and Classes
Python Variables, Constants and Literals
Python pass statement
Convert Hex to ASCII in Java
Python String swapcase()
Python list()
Python dir()
Python Machine Learning - Sebastian Raschka
Python id()
Python Program to Generate a Random Number
Python Program to Copy a File
Python RegEx
Python sleep()
Python Custom Exceptions
Python Program to Find Factorial of Number Using Recursion