Skip to content

Convert bytes to a string

You can convert a bytes array to a string using the decode() method:

byte_arr = b"abcde"
text = byte_arr.decode("utf-8") # text is "abcde"


Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.