Skip to content
Advertisement

append only if item isn’t already appended?

In my Python application, I have the following lines:

JavaScript

How can I only trigger the append statement if the index hasn’t been already appended previously?

Advertisement

Answer

Simply test if your index not in your list:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement