473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IndexError. How do I fix it?

I know why I am getting an IndexError, but I do not know how to fix it. Help? Please & thank you.

Expand|Select|Wrap|Line Numbers
  1. for i in range(2, len(resultsList), 2):
  2. newPartsList=pssMember.Grouping.monitorPat.split(resultsList[i])
  3. for i in range(0, len(newPartsList), 2):
  4.   monitorSection = newPartsList[i+1]
  5.  

This is the error I am getting:

File "/m/amoreau/testing/kaboom/pssMember.py", line 1702, in srStatusV2
monitorSection = newPartsList[i+1]
IndexError: list index out of range




Any suggestions?
Jul 15 '10 #1
2 1428
bvdet
2,851 Expert Mod 2GB
Try:
Expand|Select|Wrap|Line Numbers
  1. for i in range(0, len(newPartsList)-1, 2):
Jul 15 '10 #2
Thank you!
Jul 15 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ishwor | last post by:
i am trying to remove an item 'e' from the list l but i keep getting IndexError. I know the size of the list l is changing in the for loop & its sort of trivial task but i found no other way than...
5
by: shama.bell | last post by:
Hello, I am getting the following error when returning a list: return tbl "IndexError: each subindex must be either a slice, an integer, Ellipsis, or NewAxis" What does it mean?
7
by: Derek Schuff | last post by:
I'm sorry if this is a FAQ or on an easily-accesible "RTFM" style page, but i couldnt find it. I have some code like this: for line in f: toks = line.split() try: if int(toks,16) ==...
35
by: erikwickstrom | last post by:
Hi all, I'm sorry about the newbie question, but I've been searching all afternoon and can't find the answer! I'm trying to get this bit of code to work without triggering the IndexError. ...
7
by: python101 | last post by:
My code s= for k in range(len(s)): st=s.count(s) if st>=2: print s.pop(s.index(s)) Traceback (most recent call last):
4
by: BurnTard | last post by:
Okay, so I know what an IndexError is and all, but that doesn't help me understand why on earth I'm getting this one. I'm writing a program that's supposed skim through directories, dump all files...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.