About 9,420,000 results
Open links in new tab
  1. 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 …

  2. What is a "bytestring" (the `bytes` data type) in Python?

    Apr 3, 2014 · 69 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 …

  3. Convert bytes to a string in Python 3 - Stack Overflow

    Mar 3, 2009 · For your specific case of "run a shell command and get its output as text instead of bytes", on Python 3.7, you should use subprocess.run and pass in text=True (as well as …

  4. What is Python's bytes type actually used for? - Stack Overflow

    Oct 9, 2019 · In short, the bytes type is a sequence of bytes that have been encoded and are ready to be stored in memory/disk. There are many types of encodings (utf-8, utf-16, windows …

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

    Jun 3, 2011 · Assuming Python 3 (in Python 2, this difference is a little less well-defined) - a string is a sequence of characters, ie unicode codepoints; these are an abstract concept, and can't …

  6. How can I convert bytes object to decimal or binary …

    I wanted to convert an object of type bytes to binary representation in python 3.x. For example, I want to convert the bytes object b'\x11' to the binary representation 00010001 in binary (or 17 …

  7. python - How to write a list of numbers as bytes to a binary file ...

    With Python 2 on Windows, I found that writing a bytearray still converts \n to \r\n, making it unsatisfactory for binary data, if the "b" flag is not passed when opening the file.

  8. Python 3 - Encode/Decode vs Bytes/Str - Stack Overflow

    I repeat: Encode () returns an 8-bit string both under Python 2 and Python 3. It's called "str" in Python 2 and "bytes" in Python 3, but both are 8-bit strings.

  9. python - How is int.from_bytes () calculated? - Stack Overflow

    May 24, 2018 · 10 I am trying to understand what from_bytes() actually does. The documentation mention this: The byteorder argument determines the byte order used to represent the integer. …

  10. python - Why does "bytes (n)" create a length n byte string …

    The ASCIIfication of 3 is "\x33" not "\x03"! That is what python does for str(3) but it would be totally wrong for bytes, as they should be considered arrays of binary data and not be abused …