title: Convert int to "byte" in Python
body: <p>This is a somewhat strange question. I need to convert an int, such as <code>123456</code>, to bytes in the format <code>b'123456'</code>. I'm not doing an actual conversion to bytes however, I'm just changing the format to look like a byte and be interpreted as one. So I literally need to do the following:</p>
  <pre><code>10 = b'10'
  20 = b'20'
  30 = b'30'
  </code></pre>
  <p>and so. I can't convert to a string because I need the results to be in bytes, and I can't do an actual byte conversion because <code>bytes([10]) == b'\n'</code> (and not <code>b'10'</code>).</p>
  <p>Any help is very much appreciated</p>