While executing programs with large lists ,i am encountering an error message:
Index error:List index out of range
The program works well with small lists..Can anyone suggest me some efficient methods to handle this problem?or Is there any other efficient datastructure other than lists and dictionary to serve the purpose ?
athirar
0
Newbie Poster
Recommended Answers
Jump to Postyou could split your list in to 2 smaller lists and process them indervidualy.
Also you may wish to look into vectors
Chris
Jump to PostI don't think it has much to do with the size of the list, you are simply going past the number of indexed elements. Look at this example:
my_list = [1, 2, 3, 4] print my_list[4] # IndexError: list index out of range
All 5 Replies
Freaky_Chris
299
Master Poster
Ene Uran
638
Posting Virtuoso
Freaky_Chris
299
Master Poster
woooee
814
Nearly a Posting Maven
kdoiron
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.