Comparing data and remove duplicates in views

Lets say I have the following variables

data which contains the following [('TenGigabitEthernet1/0/1',), ('TenGigabitEthernet1/0/2',),('TenGigabitEthernet1/0/3',),('TenGigabitEthernet1/0/4',),('TenGigabitEthernet1/0/5',)]

input that contains ['TenGigabitEthernet1/0/1', 'TenGigabitEthernet1/2/2'].

How do i compare the two variable and remove the duplicate TenGigabitEthernet1/0/1 from input and append TenGigabitEthernet1/2/2 to the variable data from input

I tried the following but it cannot work. Got the following error 'list' object is not callable

for i in data:
   for a in input
       if input(a) == data(i):

How do i correct this to make it work? I think my logic is correct but just dont know how to code it

This isn’t a Django issue, this is fundamentally a Python question.


And I would suggest getting used to using the Python shell (possibly along with the Django shell) for learning how to experiment with data and data structures in Python. It’s a lot faster to try things out in the shell than doing everything through the web app.

Sorry about that and thanks for the links :slight_smile: