Re: [Python] struct unpack di un intero

2021-10-21 Per discussione Marco De Paoli
ciao Roberto, Il giorno gio 21 ott 2021 alle ore 11:15 Roberto De Ioris ha scritto: > Ciao, perche' di default viene rispettato l'allineamento che il dato > dovrebbe avere in memoria se fosse una struttura c: > > https://docs.python.org/3/library/struct.html#struct-alignment > > Roberto De Ioris

Re: [Python] struct unpack di un intero

2021-10-21 Per discussione Roberto De Ioris
Ciao, perche' di default viene rispettato l'allineamento che il dato dovrebbe avere in memoria se fosse una struttura c: https://docs.python.org/3/library/struct.html#struct-alignment Roberto De Ioris Il giorno gio 21 ott 2021 alle ore 11:12 Marco De Paoli ha scritto: > ciao a tutti! > ho un p

[Python] struct unpack di un intero

2021-10-21 Per discussione Marco De Paoli
ciao a tutti! ho un problema con struct.unpack e non capisco cosa sto sbagliando... >>> struct.unpack("i", b'\x03\x00\x00\x00') # OK! (3,) >>> struct.unpack("ih", b'\x03\x00\x00\x00\x04\x00') # OK! (3, 4) >>> struct.unpack("ihi", b'\x03\x00\x00\x00\x04\x00\x00\x00\x04\x00') # ARGHHH Traceback (