Python Remove Item From List

August 24, 2018
items = ['jake', 'sam', 'joey']

# remove by value
if 'jake' in items:
  items.remove('jake')

# remove by index
if len(items) > 0:
  del items[0]

# remove by index and return the value
if len(items) > 0:
  name = items.pop(0)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.