Skip to content

Instantly share code, notes, and snippets.

@extemporalgenome
Forked from anonymous/gist:2050036
Created March 16, 2012 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save extemporalgenome/2050048 to your computer and use it in GitHub Desktop.
Save extemporalgenome/2050048 to your computer and use it in GitHub Desktop.
hex_buffer
def hex_buffer(buf):
retstr=''.join(map(lambda c:'\\x%02x'%ord(c),buf))
retstr="E'"+retstr+"'"
return retstr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment