[Tutor] Processing a string of bytes

Kent Johnson kent37 at tds.net
Fri Sep 4 16:01:05 CEST 2009


On Thu, Sep 3, 2009 at 3:17 PM, David Perlman <dperlman at wisc.edu> wrote:
> So, in summary, I would be interested in either of two things:
> 1. advice on how to do arithmetic on the string of bytes without converting
> it to a list of ints first, or
> 2. advice on how to convert it to a list of ints, and then back to a string
> of bytes.

Use the struct module to do the conversion. Don't worry about the
memory; 15000 integers is not much. You have to convert to a numeric
form to do you calculations, anyway.

Kent


More information about the Tutor mailing list