About 236,000 results
Open links in new tab
  1. Convert bytes to a string in Python 3 - Stack Overflow

    Mar 3, 2009 · Here, the function will take the binary and decode it (converts binary data to characters using the Python predefined character set and the ignore argument ignores all non …

  2. python - How to convert a byte array to string? - Stack Overflow

    Nov 10, 2020 · You can convert it to a string by calling the bytearray.decode () method and supplying an encoding. For example: byte_array.decode('ascii'). If you leave the decoding …

  3. How to convert string to byte array in Python - Stack Overflow

    Mar 13, 2021 · An alternative to get a byte array is to encode the string in ascii: b=s.encode('ascii').

  4. python 3.x - python3: bytes vs bytearray, and converting to and …

    Jul 14, 2020 · I'd like to understand about python3's bytes and bytearray classes. I've seen documentation on them, but not a comprehensive description of their differences and how they …

  5. python - What is the difference between a string and a byte string ...

    Jun 3, 2011 · In Python, a byte string is represented by a b, followed by the byte string's ASCII representation. A byte string can be decoded back into a character string, if you know the …

  6. python - Convert byte string to bytes or bytearray - Stack Overflow

    Feb 10, 2016 · In contrast, general purpose containers of bytes, say a list[int] or even list[bytes], use the full Python representation for elements. Instead of storing an array of byte data, they …

  7. How to convert string to bytes in Python 3 - Stack Overflow

    Just a cautionary note from Python in a Nutshell about bytes: Avoid using the bytes type as a function with an integer argument. In v2 this returns the integer converted to a (byte)string …

  8. python - How to convert string to byte arrays? - Stack Overflow

    May 22, 2014 · Python 2.6 and later have a bytearray type which may be what you're looking for. Unlike strings, it is mutable, i.e., you can change individual bytes "in place" rather than having …

  9. python - Byte Array to Hex String - Stack Overflow

    Oct 6, 2013 · I have data stored in a byte array. How can I convert this data into a hex string? Example of my byte array: array_alpha = [ 133, 53, 234, 241 ]

  10. What's the correct way to convert bytes to a hex string in Python 3?

    Jul 8, 2011 · Python has bytes-to-bytes standard codecs that perform convenient transformations like quoted-printable (fits into 7bits ascii), base64 (fits into alphanumerics), hex escaping, gzip …

Refresh