title: Read multiple bytes in Hexadecimal file using python
body: <p>I have a hex file which appears as below:-</p>
  
  <pre><code>00000000 AA AA 11 FF EC FF E7 3E FA DA D8 78 39 75 89 4E
  00000010 FD FD BF E5 FF DD FF AA E9 78 67 84 90 E4 87 83
  00000020 9F E7 80 FD FE 73 75 78 93 47 58 93 EE 33 33 3F
  </code></pre>
  
  <p>I want to read 3rd and 4th byte. Swap these two bytes and save them in a variable. For e.g, i want to save 0xFF11 (after byteswap) in variable "num"</p>
  
  <p>This is what i tried:
  I read these two bytes one by one</p>
  
  <pre><code>data=open('xyz.bin','rb').read()
  num1=data[2]
  num2=data[3]
  num1,num2=num2,num1
  num= num1*100+num2
  print(num)
  </code></pre>
  
  <p>Now the problem is num variable has integer value and i have no idea how to get hex into it.
  I am stuck here and not able to proceed further. Any help would be welcomed. </p>
  
  <p>PS: I am very new to python.</p>