[Tutor] Need to convert 1,987,087,234,456 to an int
Eric Brunson
brunson at brunson.com
Thu Aug 16 05:37:20 CEST 2007
Dick Moores wrote:
> At 06:58 PM 8/15/2007, John Fouhy wrote:
>
>> You could do this:
>>
>>
>>>>> def decomma(*t):
>>>>>
>> ... return int(''.join(str(i) for i in t))
>>
>
> What's that asterisk doing in decomma(*t)? Where do I go in the docs
> to look it up?
>
>
It's the opposite of "def f( *args )"
It's easiest to show by example:
>>> def f( *args ):
... print args
...
>>> f( 1 )
(1,)
>>> f( 1, 2, 3 )
(1, 2, 3)
>>> f( (1, 2, 3) )
((1, 2, 3),)
>>> f( *(1, 2, 3) )
(1, 2, 3)
This is your brain on python. Any questions?
:-)
> Thanks,
>
> Dick
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list