About 22,300 results
Open links in new tab
  1. struct - Fastest way to pack a list of floats into bytes in python ...

    Mar 30, 2012 · This is good, but it's worth noting the ' * ' operator seems inefficient, it is needlessly convting floatlist into a tuple before passing it to struct.pack. Is there a way to pack from an …

  2. binary - Python struct.pack and unpack - Stack Overflow

    Oct 14, 2020 · struct.pack takes non-byte values (e.g. integers, strings, etc.) and converts them to bytes. And conversely, struct.unpack takes bytes and converts them to their 'higher-order' …

  3. packing and unpacking variable length array/string using the …

    51 The struct module does only support fixed-length structures. For variable-length strings, your options are either: Dynamically construct your format string (a str will have to be converted to a …

  4. Packing and Unpacking binary float in python - Stack Overflow

    I am having some trouble with packing and unpacking of binary floats in python when doing a binary file write. Here is what I have done: import struct f = open ('file.bin', 'wb') value = …

  5. python - How can I pack a string in struct.pack - Stack Overflow

    Oct 30, 2018 · I am trying to pack a string using struct.pack. I am able to see complete value if I use integer type but when I want to use string I only see one character. …

  6. python unpack little endian - Stack Overflow

    It uses the same type format as the struct module. < means "little-endian,standard size (16 bit)" If you use <> with the struct module then standard sizes are fixed and independent of anything. …

  7. Creating packet using struct.pack with python - Stack Overflow

    Feb 18, 2013 · my_packet = struct.pack('!L4sL4s',field1,field2,field3) Note that this line expects an unsigned long int, then string of length 4, then long int, then string of length 4. field2 and field4 …

  8. Understanding struct.pack in python 2.7 and 3.5+ - Stack Overflow

    I understand that struct.pack is converting the two integers (shorts) to a c style struct. But why does the output in 2.7 differ so much from 3.5? Unfortunately I am stuck with python 2.7 for …

  9. Python struct.pack () for individual elements in a list?

    Python struct.pack () for individual elements in a list? Asked 12 years, 5 months ago Modified 6 years, 11 months ago Viewed 20k times

  10. python struct.pack(): pack multiple datas in a list or a tuple

    Jan 15, 2016 · If want to struct.pack them individually, i have to use struct.pack('<Q', 12974658) or if i want to do it as multiple, then i have to explicitly mention it like this struct.pack('<4Q', …