title: Unpack format characters in Python
body: <p>I need the Python analog for this Perl string:</p>
  
  <pre><code>unpack("nNccH*", string_val)
  </code></pre>
  
  <p>I need the <code>nNccH*</code> - data format in Python format characters.</p>
  
  <p>In Perl it unpack binary data to five variables:</p>
  
  <ul>
  <li>16 bit value in "network" (big-endian)</li>
  <li>32 bit value in "network" (big-endian)</li>
  <li>Signed char (8-bit integer) value</li>
  <li>Signed char (8-bit integer) value</li>
  <li>Hexadecimal string, high nibble first</li>
  </ul>
  
  <p>But I can't do it in Python</p>
  
  <p>More:</p>
  
  <pre><code>bstring = ''
  while DataByte = client[0].recv(1):
      bstring += DataByte
  print len(bstring)
  if len(bstring):
      a, b, c, d, e = unpack("nNccH*", bstring)
  </code></pre>
  
  <p>I never wrote in Perl or Python, but my current task is to write a multithreading Python server that was written in Perl...</p>