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

    Mar 3, 2009 · 430 Decode the byte string and turn it in to a character (Unicode) string. Python 3:

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

    Jun 3, 2011 · Remember, however, that byte strings aren't human-readable, it's just that Python decodes them from ASCII when you print them. In Python, a byte string is represented by a b, …

  3. 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 because bytes is …

  4. string - What is a "bytestring" (the `bytes` data type) in Python ...

    Apr 3, 2014 · What exactly is a "bytestring" in Python? What is the bytes type, and how does it work internally? My understanding is that there are normal "ASCII strings", which store a seque...

  5. Is there a formatted byte string literal in Python 3.6+?

    The idea is explicitly dismissed in the PEP: For the same reason that we don't support bytes.format(), you may not combine 'f' with 'b' string literals. The primary problem is that an object's __format__() …

  6. How to convert hexadecimal string to bytes in Python?

    262 I have a long Hex string that represents a series of values of different types. I need to convert this Hex String into bytes or bytearray so that I can extract each value from the raw data. How can I do …

  7. Python: Get size of string in bytes - Stack Overflow

    May 5, 2025 · The most interesting thing with str in Python: it has adaptive representation depending on present characters: it could be latin-1 (1 byte per char), UCS-2 (2 bytes per char) or UCS-4 (4 bytes …

  8. How to print byte representation of a string? - Stack Overflow

    Apr 11, 2022 · So I have a string like "abcd" and I want to convert it into bytes and print it. I tried print (b'abcd') which prints exactly b'abcd' but I want '\x61\x62\x63\x64'.

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

    91 Say that I have a 4 character string, and I want to convert this string into a byte array where each character in the string is translated into its hex equivalent. e.g.

  10. string - Print without b' prefix for bytes in Python 3 - Stack Overflow

    Apr 24, 2022 · Print without b' prefix for bytes in Python 3 Asked 12 years, 9 months ago Modified 2 years, 2 months ago Viewed 203k times