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 File I/O Operation
Python slice()
Python for Loop
Python break and continue
Deep Learning with Python - A Hands-on Introduction - Nikhil Ketkar
Python Dictionary values()
Python Program to Delete an Element From a Dictionary
Python Global Keyword
Python Package
Machine Learning Applications Using Python - Cases studies form Healthcare, Retail, and Finance - Pu...
Python Directory and Files Management
Python hash()
Python Program to Differentiate Between del, remove, and pop on a List
Python Program to Generate a Random Number
Java Program to Convert a Decimal Number to Binary Number using Stacks
Python Program to Sort a Dictionary by Value
Python @property decorator
Python Set symmetric_difference()
Python Program to Find LCM
Python bin()
Python String rstrip()
Python bytearray()
Python Set clear()
Python String isnumeric()
Python Program to Catch Multiple Exceptions in One Line
Python Set discard()
Python Operator Overloading
Deep Learning with Python - Francois Chollet
Python Modules
Python Program to Convert String to Datetime
Python Program to Copy a File
Python String strip()