Skip to content

Instantly share code, notes, and snippets.

@baversjo
Created August 7, 2011 00:18
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 baversjo/1129922 to your computer and use it in GitHub Desktop.
Save baversjo/1129922 to your computer and use it in GitHub Desktop.
var buf = new Buffer(4);
buf.writeUInt16(3000,0,'big');
console.log(buf);
// <Buffer 0b b8 7a 00>
buf = struct.pack('!h',3000)
print list(map(lambda a: hex(ord(a)),buf))
//['0xb', '0xb8'] but I want:
// 0b b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment