Though, of course, by modifying your way (using str() ), it will still work:

>>> def listtoint(digits):
    result = 0
    for digit in digits:
        result *= (10**len(str(digit))) ## just multiply it by 10 
        result += digit ## to the power of the number of digits
    return result
>>> listtoint([11,22,33,44])
11223344
>>> listtoint([1,2,3,4])
1234

-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to