Matthew Diephouse <fokke_wulf at hotmail.com> writes: > I have the following perl code, which I'm trying to translate to python: > > my $out = hex( shift(@_) ); > $out = pack("N", $out); Maybe I don't understand this, but if you're trying to convert a hex string to a binary string, use: import binascii out = binascii.unhexlify(hex_string)