Python3 Encode String into Bytes
Lets Say we have :
>>> x = "Happiness"
#In order to Convert / Format / Encode our String / Text into Bytes we just have to call the method encode() :
>>> x.encode()
b'Happiness'
#Lets put it into a variable then decode it :
>>> y = x.encode()
>>> y
b'Happiness'
>>> y.decode() #Now we decode it to String format Back from Bytes format
'Happiness'
Join the conversation