I am trying to pack a string and the length of a string.
fmt = '<P' + str(len(string)) + 'p'
This leads me to an error : struct.error: bad char in struct format Whereas, doing
fmt = 'P' + str(len(string))+'p'
Does not give me an error. I am unable to understand why this happens, my understanding is that specifying '<' at the start will make it little endian regardless of the native machine.