unexplainable python

Chris Rebert clp2 at rebertia.com
Sun Sep 27 04:50:25 CEST 2009

On Sat, Sep 26, 2009 at 7:37 PM, dads <wayne.dads.bell at gmail.com> wrote:
> When creating a script that converts digits to words I've come across
> some unexplainable python. The script works fine until I use a 5 digit
> number and get a 'IndexError: string index out of range'.

Please provide the full error traceback. Help us help you.

>    def __init__(self, number):
>        #remove any preceding zero's
>        num = int(number)
>        self.num = str(num)
>        self.num = number

I can tell you right now, the first 2 lines of this method have no net effect.


More information about the Python-list mailing list