Typeerror

Beema shafreen beema.shafreen at gmail.com
Wed May 21 05:23:51 EDT 2008


Thanks a lot i had solved the problem

On Wed, May 21, 2008 at 2:32 PM, <jonbutler88 at googlemail.com> wrote:

> On May 21, 9:58 am, Freaky Chris <angry-ch... at hotmail.com> wrote:
> > This is a simple error, you are passing the variable res as an interger
> to
> > use for a slice when what ever you are storing in res isn't an integer.
> >
> > Chris
> >
> >
> >
> > Beema shafreen wrote:
> >
> > > Hi all,
> > > I getting the following error when i run my scirpt ,
> > > can somebody help me regarding this to solve the type error problem
> >
> > > Traceback (most recent call last):
> > >   File "get_one_prt_pep.py", line 59, in ?
> > >     if len(data[res])<=1:
> > > TypeError: string indices must be integers
> >
> > > --
> > > Beema Shafreen
> >
> > > --
> > >http://mail.python.org/mailman/listinfo/python-list
> >
> > --
> > View this message in context:
> http://www.nabble.com/Typeerror-tp17358659p17358932.html
> > Sent from the Python - python-list mailing list archive at Nabble.com.
>
> If it is an integer, but stored as a string you can use:
>
> if len(data[int(res)])<=1
>
> its not pretty but it should sort out the type errors
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Beema Shafreen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080521/03628f40/attachment-0001.html>


More information about the Python-list mailing list