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