unexplainable python

Chris Rebert clp2 at rebertia.com
Sat Sep 26 22:50:25 EDT 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.

<snip>
>    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.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list