Problems using struct pack/unpack in files, and reading them.
Ian Kelly
ian.g.kelly at gmail.com
Fri Nov 13 14:36:22 EST 2015
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg <kent at z-sverige.nu> wrote:
> def LoadCommandAndReact(place_to_read):
> global RegisterAX
>
> tmp = place_to_read.read()[RegisterAX:calcsize('HH')]
It looks like you're trying to get a slice of length 4 here, starting
at the value of RegisterAX. What you're actually getting is a slice
starting at the value of RegisterAX and ending at 4. You probably want
this instead:
tmp = place_to_read.read()[RegisterAX:RegisterAX + calcsize('HH')]
More information about the Python-list
mailing list