title: Python hex to int conversion error
body: <pre><code>&gt;&gt;&gt; print(int(0x51))
  </code></pre>
  
  <p>81</p>
  
  <p>This is correct.</p>
  
  <pre><code>&gt;&gt;&gt; str = 51
  &gt;&gt;&gt; cmd = "0x%s" %(str)
  &gt;&gt;&gt; print(int(cmd))
  </code></pre>
  
  <p>But why is this incorrect?
  I get ValueError: invalid literal for int() with base 10: '0x51'</p>