Skip to content

Instantly share code, notes, and snippets.

@mh0w
Created October 21, 2022 15:12
Show Gist options
  • Save mh0w/559aa2f10796b7e0b06dbdac9f56c073 to your computer and use it in GitHub Desktop.
Save mh0w/559aa2f10796b7e0b06dbdac9f56c073 to your computer and use it in GitHub Desktop.
lists: create, isolate, remove, clear
mylist = ['a', 'b', 'c', 'd']
# Remove item 1
mylist.pop(1) #'b'
print(l) #['a', 'c', 'd']
# Remove item with value 'd'
mylist.remove('d')
print(l) # ['a', 'c']
# Clear (remove all items)
mylist.clear()
print(l) # []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment