Best way to convert sequence of bytes to long integer

Paul Rubin no.email at nospam.invalid
Wed Jan 20 04:10:41 EST 2010


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> s = "g%$f yg\n1\05"
> Is this the best way, or have I missed some standard library function?

It is really a shame that there is not a standard library function
for this.  I usually do it using hexadecimal conversion:

  d = int(s.encode('hex'), 16)



More information about the Python-list mailing list