How would I go about removing an array item from an array in a way that keeps the array index in an incremental list?
Basically I want to do this:
Modify the following array so that it results in the next one
#before
arrayName[0] = "asdf random text"
arrayName[1] = "more randomasdf"
arrayName[2] = "this is the array item i am about to remove"
arrayName[3] = "another asdfds"
arrayName[4] = "and som easdf"
#after
arrayName[0] = "asdf random text"
arrayName[1] = "more randomasdf"
arrayName[2] = "another asdfds"
arrayName[3] = "and som easdf"
Notice how arrayName[2] from the #before array is gone in the #after array and the index has been reordered so that arrayName[3] from the #before array is now arrayName[2].
I want to delete the array item and reorder the array index.
How can I do this efficiently?
If by “array” you actually mean “list”, you can simply use
del: