Large integers from C

Gustavo Niemeyer niemeyer at conectiva.com
Wed Feb 20 13:51:33 EST 2002


> Convert to hexadecimal and do intval = int(hexval, 16).
> Really, no joke.

You probably meant long(str, base):

>>> int('fffffffffffffffffffffffffff', 16)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: int() literal too large: fffffffffffffffffffffffffff
>>> long('fffffffffffffffffffffffffff', 16)
324518553658426726783156020576255L
>>> 

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]




More information about the Python-list mailing list