title: writing a 1024 bits length decimal number in a binary file with python
body: <p>i have actually obtained a 1024 bits length decimal number (representing half of a rsa key of 2048 bits).</p>
  
  <p>I would like to then write this number into a binary file, e.g. the bytes of this file will directly represent the number.</p>
  
  <p>I figured for example how to do so with a long number, "4444" for example:</p>
  
  <pre><code>with open('test','wb') as f:
       for b in struct.pack('&gt;L',4444):
           f.write(b)
  </code></pre>
  
  <p>i then get those bytes in the binary file : 00 00 11 5c</p>
  
  <p>however, how can i do so for long numbers, like a 1024 bit length one?</p>
  
  <p>thanks for any answer!</p>