At 06:58 PM 8/15/2007, John Fouhy wrote: >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
Tried again just now, and I got what you got. However: >>>m = 1,987,077,234,456 >>>type(m) == tuple True >What python are you using? (2.5.1 for me) XP, Python 2.5, editor is Ulipad > > 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 That's cool! However, it doesn't solve the problem in my original post. >>> t = 1,987,087,234,456 File "<input>", line 1 t = 1,987,087,234,456 ^ SyntaxError: invalid token >>> def decomma(*t): return int(''.join(str(i) for i in t)) >>> decomma(1,987,087,234,456) File "<input>", line 1 decomma(1,987,087,234,456) ^ SyntaxError: invalid token Dick _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor