Python Bytes to String Conversion || Python


In this we are going to see a basic program of bytes to string conversion in Python Programming Language.



# We Will Use built-in decode() method, which is used to convert bytes to a string.

b1 = b"Let's Eat A Pizza \xf0\x9f\x8d\x95!"
print(type(b1))  
str1 = b1.decode('UTF-8')  
print(type(str1))  
print(str1)

# Second
b2 = b"Check List \xE2\x9C\x85"
print(type(b2))  
str2 = b2.decode('UTF-8')  
print(type(str2))  
print(str2)

# Coded By DHIRAJ SHELKE


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post