title: python struct.pack(): pack multiple datas in a list or a tuple
body: <p>Say i have a <code>list</code> or a <code>tuple</code> containing numbers of type <code>long long</code>,</p>
  
  <pre><code>x = [12974658, 638364, 53637, 63738363]
  </code></pre>
  
  <p>If want to <code>struct.pack</code> them individually, i have to use </p>
  
  <pre><code>struct.pack('&lt;Q', 12974658)
  </code></pre>
  
  <p>or if i want to do it as multiple, then i have to explicitly mention it like this</p>
  
  <pre><code>struct.pack('&lt;4Q', 12974658, 638364, 53637, 63738363)
  </code></pre>
  
  <p>But, how can i insert items in a <code>list</code> or <code>tuple</code> inside a <code>struct.pack</code> statement.  I tried using <code>for</code> loop like this.</p>
  
  <pre><code>struct.pack('&lt;4Q', ','.join(i for i in x))
  </code></pre>
  
  <p>got error saying <code>expected string, int found</code>, so i converted the list containing type <code>int</code> into <code>str</code>, now it gets much more complicated to pack them. Because the whole list gets converted into a string( like a single sentence).</p>
  
  <p>As of now im doing some thing like </p>
  
  <pre><code>binary_data = ''
  x = [12974658, 638364, 53637, 63738363]
  for i in x:
      binary_data += struct.pack('&lt;Q', i)
  </code></pre>
  
  <p>And i unpack them like </p>
  
  <pre><code>struct.unpack('&lt;4Q', binary_data)
  </code></pre>
  
  <p><strong>My question:</strong> is there a better way around, like can i directly point a <code>list</code> or <code>tuple</code> inside the <code>struct.pack</code> statement, or probably a one liner ?</p>