Python integer to hex string with padding
<p>Consider an integer 2. I want to convert it into hex string '0x02'. By using python's built-in function <code>hex()</code>, I can get '0x2' which is not suitable for my code. Can anyone show me how to get what I want in a convenient way? Thank you. </p>