December 7th, 2012, 11:31 AM
List Inexplicably Changes Size
This is probably a simple answer for most of you, but I have a loop in which I assign elements of a new list. Following this loop, I print the size of the new list and it is much larger than it was in the loop. Below is the snippet of relevant code:
The end result is:
for i in range(len(dbPartNamesV1)):
dbPartNamesV2.insert(i, dbPartNamesV1[i].replace('-', '_'))
Any help is appreciated!
December 7th, 2012, 11:32 AM
As I continue to look at this, could it be that it is inserting two elements into the new list for every one element of the old list? My intent was to overwrite each element so that the new list is the same length as the old list.
December 7th, 2012, 11:34 AM
Help on method_descriptor:
L.insert(index, object) -- insert object before index