You probably want to look at using struct.pack. That will allow you
to back heterogenious groups of data into a string that can be saved
to disk or sent over the network. It also does a really good job of
taking care of byte order for you(if you tell it to).
-Chris
On 8 Jun 2005 10:40:43 -0700,
How do i fill 1 byte and 4 bytes in a single array? This array contains
packet information.
Python code...
from array import *
size = 526
pData = array("B", '\0'* 526)
# Destination MAC address
destAddress =
for i in range(0, len(destAddress), 2):
pData[i/2] = int(destAddress[i: