Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98758 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2015-11-13 12:36 -0700 |
| Last post | 2015-11-13 12:36 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-13 12:36 -0700
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-11-13 12:36 -0700 |
| Subject | Re: Problems using struct pack/unpack in files, and reading them. |
| Message-ID | <mailman.298.1447443424.16136.python-list@python.org> |
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg <kent@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')]
Back to top | Article view | comp.lang.python
csiph-web