Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. "x7fxe8x89x00x00x00x60x89xe5x31xd2x64x8bx52"
  2.  
  3. with open('a', 'rb') as f:
  4. byte = f.read(1)
  5. hexbyte = '\x%02s' % byte
  6. print hexbyte
  7.  
  8. txt = open('out.txt', 'w')
  9. print >> txt, hexbyte
  10. txt.close()
  11.  
  12. from binascii import hexlify
  13. with open('test', 'rb') as f:
  14. print(hexlify(f.read()).decode('utf-8'))
  15.  
  16. with open('input_file', 'rb') as file:
  17. print repr(file.read())
  18.  
  19. with open('input_file', 'rb') as file:
  20. print "\x" + "\x".join([c.encode('hex') for c in file.read()])
  21.  
  22. with open("default.png",'rb') as file_png:
  23. a = file_png.read()
  24.  
  25. l = []
  26. l.append(a)
  27. print l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement