This is the idea Block = pack("240s", "") Block[0:4] = pack(">H", W) Block[4:8] = pack(">H", X) Block[8:12] = pack(">B", Y) Block[12:16] = pack(">H", Z))
but, of course, Block, a str, can't be sliced. The real use of this is a bit more complicated such that I can't just fill in all of the "fields" within Block in one giant pack(). I need to build it on the fly. For example the pack(">H", X) may be completely skipped some times through the function. There are many more fields in Block than in this example and they are all kinds of types not just H's and B's. What I really want is a C struct union. :) How would I do this? Thanks! Bob -- http://mail.python.org/mailman/listinfo/python-list