Arduino Serial Communication with Python: sending an array
If I use >BBB instead of >iii... That's because "B" is a byte. So you end up sending 3 bytes:

struct.pack("BBB", 1, 2, 3)
\x01\x02\x03


"i" is an int and has a size of 4, so you send 4*3 = 12 bytes:

struct.pack("iii", 1, 2, 3)
\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00


Serial.read() reads 1 byte at a time, so you need to read 4 bytes for each value. 



Here's a function to read a 32-bit int. The drawbacks of this method are that a) it will block until 4 bytes have been read. And b) there's no way to tell if some data has been lost. There are more robust ways to send data with Start-of-Message, End-of-Message, and Check-sum chars. Also, the function assumes the data is sent with the LSB first. But I'll just put this here as an example.

// Helper macro to merge 4 bytes
#define TO_INT32(a,b,c,d) (((d)&lt;&lt;24)|((c)&lt;&lt;16)|((b)&lt;&lt;8)|(a))
int32_t read_int()
{
  uint32_t result[4];
  for (int i = 0; i &lt; 4; i++) {
    // Wait for data at the port
    while (!Serial.available());
    result[i] = Serial.read();
  }
  return TO_INT32(result[0], result[1], result[2], result[3]);
}