Java Integer.ParseInt translation to python

Paul Rubin http
Mon Jan 31 19:23:19 EST 2005


"jose isaias cabrera" <jicman at cinops.xerox.com> writes:
> I've looked through the internet (not long, though) but I have not
> been able to find a python translation to
> 
> buffer[0] = (byte)Integer.parseInt(string,16);
> 
> Has anyone ported any java programs to python and has translated this?

I think the Python equivalent would be:

  buffer[0] = chr(int(string, 16))

That is, you're trying to convert two hex digits into a single char, right?



More information about the Python-list mailing list