Remove Items from list - Python

How might I remove several items from a list?

I have a list of curves, and a list of indices which indicate which curves to remove from the list. I have tried to use list.remove, list.Remove, and list.RemoveAt - all of which give undesirable results. These all require only 1 argument, which limits the number of items that I can remove from the list of curves.

Please post a graph indicating what you are after and what you tried if this solution doesn’t work.

This is a sample script. The logic is to check the endpoint of each curve and find any startpoints that are within 5’. If curve startpoints are within 5’, append those curves to a list with the original curve. Then remove the appended curve from the original list.

I got at far as appending curves within 5’, but now have duplicate curves. I would like these to be removed from the list.

I found a way to make it work. I replaced all items to be removed with ‘None’. This results in a null value that I can cull from the list.
image

1 Like