title: How to byte-swap a 32-bit integer in python?
body: <p>Take this example:</p>
  
  <pre><code>i = 0x12345678
  print("{:08x}".format(i))
     # shows 12345678
  i = swap32(i)
  print("{:08x}".format(i))
     # should print 78563412
  </code></pre>
  
  <p>What would be the <code>swap32-function()</code>? Is there a way to byte-swap an <code>int</code> in python, ideally with built-in tools?</p>