struct.pack Format String Question

Joshua Forgione jforgion at vt.edu
Tue Mar 30 16:25:27 EST 2004


Hello.  I am reverse engineering some Python Code.  I am using the book
"The Quick Python Book" as an aide.

The following line exists in the code:

msg = struct.pack('BBBB',word0, word1, word2, word3, word4)

In this struct.pack command, the format string is 'BBBB.'  In the book,
it gives the following examples for characters that are meaningful to
struct:

'h' - short integer
'd' - double-precision floating point
's' - string

In this case, 'B' is used.  What does 'B' represent?  What other
characters can be used?  Does a list of this exist somewhere?

Thank you for your help.

Josh




More information about the Python-list mailing list