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:
Building Machine Learning Systems with Python - Willi Richert & Luis Pedro Coelho
Convert Time to Milliseconds in Java
Python String isprintable()
Python help()
Python Program to Find ASCII Value of Character
Python String join()
Python String lower()
Python id()
Python Program to Find Sum of Natural Numbers Using Recursion
Python compile()
Python List reverse()
Python Program to Check Prime Number
Natural Language Processing with Python - Steven Bird & Ewan Klein & Edward Loper
Python Program Read a File Line by Line Into a List
Debug a JavaMail Program
Python Program to Reverse a Number
Python String translate()
How to get current date and time in Python?
Python Set pop()
Python for Loop
Python Strings
Python enumerate()
Python Dictionary pop()
Python Program to Convert Decimal to Binary, Octal and Hexadecimal
Python Program to Multiply Two Matrices
Python String expandtabs()
Python String istitle()
Python Machine Learning - Sebastian Raschka
Python Set add()
Python Program to Find Numbers Divisible by Another Number
Python Data Structures and Algorithms - Benjamin Baka
Convert Hex to ASCII in Java