Two newbie questions
Fred Clare
fred at balzac.scd.ucar.edu
Wed Nov 8 18:50:49 EST 2000
More information about the Python-list mailing list
Wed Nov 8 18:50:49 EST 2000
- Previous message (by thread): [pyobjc] portability and clean starts (was:NSAutorelease support)
- Next message (by thread): Two newbie questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
1.) Is there a Python equivalent to the C function "sprintf"?
That is, I would like to do a formatted print and save
the result in a Python string.
2.) What is an efficient way of packing a large (i.e. > 1MB)
list of integers (that are in the range 0 to 255)
into a Python string as a sequence of contiguous bytes?
Something like the following seems very inefficient:
import struct
.
.
.
ir = [ ... lots of integers in the range 0 to 255 ... ]
bytes = ""
for x in ir:
bytes = bytes + struct.pack("B",x)
--Fred Clare
--
Fred Clare
fred at ucar.edu
- Previous message (by thread): [pyobjc] portability and clean starts (was:NSAutorelease support)
- Next message (by thread): Two newbie questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list