Python: hex conversion always two digits
<p>Does anyone know how to get a chr to hex conversion where the output is always two digits? </p>

<p>for example, if my conversion yields 0x1, I need to convert that to <code>0x01</code>, since I am concatenating a long hex string.</p>

<p>The code that I am using is: <code>hexStr += hex(ord(byteStr[i]))[2:]</code></p>

<p>Thanks.</p>
