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 break and continue
Python issubclass()
Python reversed()
Python tuple()
Python abs()
Introduction to Machine Learning with Python - Andreas C.Muller & Sarah Guido
Python Program to Create a Countdown Timer
Python Program to Remove Punctuations From a String
Python sorted()
Python callable()
Python Program to Iterate Through Two Lists in Parallel
Python while Loop
Python String expandtabs()
Python Program to Print Output Without a Newline
How to get current date and time in Python?
Python print()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman
Python Program to Convert Kilometers to Miles
Python Program to Measure the Elapsed Time in Python
Python String ljust()
Python Get Current time
Python Program to Multiply Two Matrices
Python Deep Learning - Valentino Zocca & Gianmario Spacagna & Daniel Slater & Peter Roelants
Python Set difference()
Python Program to Display Calendar
Python Program to Safely Create a Nested Directory
Python super()
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python Function Arguments
Python Program to Shuffle Deck of Cards
Python List clear()
Python List insert()