Skip to content

Instantly share code, notes, and snippets.

@venkatsgithub1
Last active April 15, 2017 17:00
Show Gist options
  • Save venkatsgithub1/9c485cf542d05b1a125012b54526d5ab to your computer and use it in GitHub Desktop.
Save venkatsgithub1/9c485cf542d05b1a125012b54526d5ab to your computer and use it in GitHub Desktop.
Python | Removal of data from list using remove method.
#Usage of remove method to remove elements from list.
list_of_items=["Watch", "Headphones", "Mobile Phone", "Laptop"]
"""
******************************
remove method removes the
actual element passed
from the list.
Data passed into remove method
not being part of list will
result in an error.
remove method doesn't return
anything back.
******************************
Below line removes Laptop from
list_of_items.
list_of_items becomes
['Watch', 'Headphones', 'Mobile Phone']
"""
list_of_items.remove ("Laptop")
print (list_of_items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment