On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> Python sees 1,987,077,234,456 as a tuple:
> >>>type(1,987,077,234,456)
> <type 'tuple'>
Hmm, not for me:
>>> type(1,987,077,234,456)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type() takes 1 or 3 arguments
What python are you using? (2.5.1 for me)
> I need to convert things such as 1,987,077,234,456 to ints.
You could do this:
>>> def decomma(*t):
... return int(''.join(str(i) for i in t))
...
Thus:
>>> decomma(1,234,567)
1234567
Of course, if you have:
>>> n = 1,234,567
Then you can't do this:
>>> decomma(n)
Instead, do this:
>>> decomma(*n)
1234567
--
John.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor