Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #!/usr/bin/python
  2. mappings = {
  3. 0x04:"A",
  4. 0x05:"B",
  5. 0x06:"C",
  6. 0x07:"D",
  7. 0x08:"E",
  8. 0x09:"F",
  9. 0x0A:"G",
  10. 0x0B:"H",
  11. 0x0C:"I",
  12. 0x0D:"J",
  13. 0x0E:"K",
  14. 0x0F:"L",
  15. 0x10:"M",
  16. 0x11:"N",
  17. 0x12:"O",
  18. 0x13:"P",
  19. 0x14:"Q",
  20. 0x15:"R",
  21. 0x16:"S",
  22. 0x17:"T",
  23. 0x18:"U",
  24. 0x19:"V",
  25. 0x1A:"W",
  26. 0x1B:"X",
  27. 0x1C:"Y",
  28. 0x1D:"Z",
  29. 0x1E:"1",
  30. 0x1F:"2",
  31. 0x20:"3",
  32. 0x21:"4",
  33. 0x22:"5",
  34. 0x23:"6",
  35. 0x24:"7",
  36. 0x25:"8",
  37. 0x26:"9",
  38. 0x27:"0",
  39. 0x28:"\n",
  40. 0x2C:" ",
  41. 0x2D:"-",
  42. 0x2E:"=",
  43. 0x2F:"[",
  44. 0x30:"]"
  45. }
  46.  
  47. nums = []
  48. keys = open('data.txt')
  49. for line in keys:
  50. nums.append(int(line.strip(),16))
  51. keys.close()
  52.  
  53. output = ""
  54. for n in nums:
  55. if n in mappings:
  56. output += mappings[n]
  57. else:
  58. output += 'x'
  59.  
  60. print 'output :' + output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement