title: python integer format conversion
body: <p>I need an application that will do the following:</p>
  <ol>
  <li>read UDP message, get data from it - the data is textual, comma separated.</li>
  <li>build a new message based on this values</li>
  <li>send a new UDP message to other destination.</li>
  </ol>
  <p>For the first and the last I'm fine. for the second I have a challenge:
  Lets say that the data I've received is <code>Year = 2020</code>. The message on the Wireshark (step 3), I shall see it as 2 bytes valued <code>07 e4</code></p>
  <p>How can I do it? I've tried couple of ways, none of them provided me with the desired format.</p>
  <p>Sample of the code:</p>
  <pre><code>data1 = '\xab\xcd\xef\xgh'
  ...
  data, addr = sock.recvfrom (200)
  elements = data.decode().split(&quot;,&quot;)
  Date=elements[15].split(&quot;/&quot;)
  Year = int(Date(2))
  year = &lt;do something with Year to convert to right format&gt;
  newMsg = data1 + year
  ...
  newSock.sendto(newMsg.encode('charmap'), (IP, int(port)))
  </code></pre>
  <p>Python version 3.5</p>