title: Understanding struct.pack in python 2.7 and 3.5+
body: <p>I am attempting to understand; and resolve, why the following happens:</p>
  
  <pre><code>$ python
  &gt;&gt;&gt; import struct
  &gt;&gt;&gt; list(struct.pack('hh', *(50,50)))
  ['2', '\x00', '2', '\x00']
  &gt;&gt;&gt; exit()
  $ python3
  &gt;&gt;&gt; import struct
  &gt;&gt;&gt; list(struct.pack('hh', *(50, 50)))
  [50, 0, 50, 0]
  </code></pre>
  
  <p>I understand that <code>hh</code> stands for 2 shorts.  I understand that <code>struct.pack</code> is converting the two integers (shorts) to a <code>c style struct</code>.  But why does the output in 2.7 differ so much from 3.5?</p>
  
  <p>Unfortunately I am stuck with <code>python 2.7</code> for right now on this project and I need the output to be similar to one from <code>python 3.5</code></p>
  
  <p>In response to comment from Some Programmer Dude</p>
  
  <pre><code>$ python
  &gt;&gt;&gt; import struct
  &gt;&gt;&gt; a = list(struct.pack('hh', *(50, 50)))
  &gt;&gt;&gt; [int(_) for _ in a]
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: invalid literal for int() with base 10: ''
  </code></pre>