Answers for "how to convert string to byte in python"

9

python convert string to bytes

data = ""  			#string
data = "".encode()	#bytes
data = b"" 			#bytes
data = b"".decode() #string
data = str(b"")  	#string
Posted by: Guest on March-14-2020
1

python convert string to byte array

a_string = "abc"
encoded_string = a_string. encode()
byte_array = bytearray(encoded_string)
print(byte_array)
Posted by: Guest on April-19-2021

Code answers related to "how to convert string to byte in python"

Python Answers by Framework

Browse Popular Code Answers by Language