python - How to remove a tuple from the list -
here list of tuple
[('abbott', 'texas'), ('abernathy', 'texas'), ('abilene', 'texas'), ('ace', 'texas'), ('ackerly', 'texas'), ('alba', 'texas'),('addison', 'texas'), ('adkins', 'texas'), ('adrian', 'texas'), ('afton', 'texas'), ('agua dulce', 'texas'), ('aiken', 'texas'), ('alamo', 'texas'), ('alanreed', 'texas'), ('albany', 'texas')] from above tuple list want remove ('alba', 'texas')
i tried many ways doing it,but not giving me result me out guys. in advance
i've tried
[x x in listobj if any(y not alba y in x)]
list_of_tuples.remove(('alba', 'texas')) or
list_of_tuples.pop(list_of_tuples.index(('alba', 'texas')))
Comments
Post a Comment