Advertisement
Guest User

Untitled

a guest
May 29th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def toHex(s):
  2. lst = []
  3. for ch in s:
  4. hv = hex(ord(ch)).replace('0x', '')
  5. if len(hv) == 1:
  6. hv = '0' + hv
  7. lst.append(hv)
  8.  
  9. return reduce(lambda x, y: x + y, lst)
  10.  
  11.  
  12. def list_to_hex(list):
  13. ret = []
  14. for element in list:
  15. ret.append(toHex(element))
  16. return ret
  17.  
  18.  
  19. def checkfile(x):
  20. L = []
  21. while True:
  22. x = raw_input('Please write the file you want to comapre : ')
  23. if x == 'Escape':
  24. break
  25. fin = open(x, 'r')
  26. fin = fin.readlines()
  27. L.append(fin)
  28. # for i in L:
  29. # list_to_hex(i)
  30.  
  31.  
  32.  
  33. return L
  34.  
  35.  
  36. print checkfile('a')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement