Q:

Convert element list to integer and shift to right

I working on python code that read one byte at time from serial and store it into list. 
Next I need to combine two bytes to obtain the payload length.  To achieve this goal I need to convert the MSB (Most significative byte) and LSB (Least significative byte) of length to integer and then shift the MSB. 
This is my List: ['H', '4', 'K', 'M', '0', '\x10', '\xff', '\x10', '\x00', '\x02', '\xff', '\xff']. 
MSB is '\x02' ans LSB is '\x00'
I store MSB and LSB in two variables and I tried to convert it to int from string by int():
payloadLenMSB_h = int(packetHeader[offsetPayloadLenMSB])
payloadLenLSB_h = int(packetHeader[offsetPayloadLenLSB])

But I receive this error:
**ValueError: invalid literal for int() with base 10: ''**

In which way I can convert the MSB and LSB of length to int? 
Next I nedd to shift MSB to right by 8 bit and conbine it with LSB. 
Any suggestions? 
This is my code to read data from serial:
print 'Available data on COM Port: ' + str(availableSerialByte)
if availableSerialByte > 0:
    readByte = serialCOM.read(1)
    print 'Read COM byte:' + str(readByte)

Thanks!!! 

A:

This should do it:
import struct
payloadLenMSB_h = struct.unpack('B', packetHeader[offsetPayloadLenMSB])[0]
payloadLenLSB_h = struct.unpack('B', packetHeader[offsetPayloadLenLSB])[0]
payloadLen = payloadLenMSB_h << 8 + payloadLenLSB_h

The 'B' denotes a single unsigned char, see the struct docs.  << means bitwise shift, once your MSB has been shifted you can simply add it to the LSB.