Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5377
| From | Christopher Arndt <chris@chrisarndt.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] binary struct in Python |
| Date | 2018-12-20 17:01 +0100 |
| Message-ID | <mailman.34.1545321694.31622.python-de@python.org> (permalink) |
| References | <2456b27e-f194-d6d4-173c-ddc36d255b91@gethmann.org> <0a5b55a2-6deb-7322-41ba-312a39307cf0@chrisarndt.de> |
Am 20.12.18 um 15:45 schrieb Julian Gethmann:
> Eigentlich könnte man sie mit "cffffefc" lesen,
Wenn der Formatstring kein Präfix hat, wird native Byteorder und
Alignment angenommen.
https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment
Du hast aber kein Alignment, also musst ein Präfix benutzen, also z.B.
bei Big-Endian Byteorder:
>>> struct.unpack('>cffffefc', data)
(b'B', 4.3712104296148344e-41, 2.822691548628052e-40,
1.0399035903754467e-40, 5.658303069097179e-41,
0.00034618377685546875, 0.0, b'\r')
Gruß, Chris
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] binary struct in Python Christopher Arndt <chris@chrisarndt.de> - 2018-12-20 17:01 +0100
csiph-web