Shihpin said unto the world upon 06/03/2007 08:23 PM:
> Hi all,
> 
> Is there a fuction that reverse the digits of a number?
> 
> Many thanks,
> 
> Shihpin Lin
> 

This does it:

>>>> def reversed_int(i):
> ...     return int(''.join(reversed(str(i))))
> ... 
>>>> reversed_int(12345)
> 54321
>>>> 
> 

Best,

Brian vdB
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to