string to big int
Gerhard Häring
gerhard.haering at gmx.de
Sat Aug 31 12:03:28 EDT 2002
* Axel Grune <NineOfSix at gmx.de> [2002-08-31 17:51 +0200]:
> Hi, Im wondering how to convert a string which contains a huge integer
> ("10000000000007") to a real integer (type int). When I ask int() to
> this it replies:
>
> Traceback (most recent call last):
> File "C:\prime.py", line 43, in ?
> main()
> File "C:\prime.py", line 29, in main
> no = int( argv)
> ValueError: int() literal too large: 10000000000007
>
> any ideas?
1) Upgrade to a 64-bit box
or
2) Use long() to create a Python long value.
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list