Advertisement
marwanpro

mdl_str2hex

Jan 10th, 2015
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. # -*- codage: latin-1 -*-
  2. __author__ = 'Marwan'
  3.  
  4.  
  5. def str2hex(strraw):
  6.     import binascii
  7.     if isinstance(strraw, str):
  8.         binaryhex = binascii.hexlify(bytes(strraw, 'latin-1'))
  9.         hexstr = binaryhex.decode("latin-1")
  10.         return hexstr
  11.     else:
  12.             print("strraw is not a str")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement