The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Remove An Item From A Python List With .remove()

TODO: Pull subtitle into page object

** TL;DR

Use `.remove()` to remove a value from a Python list.

code_start_default_section code_end_default_section
Results
['Jen', 'Jonas']

If you don't check to see if the value is in the list and try to remove one that isn't there it'll throw an error.

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Remove An Item From A Python List With .remove()

-- p

** TL;DR

-- p

Use `.remove()` to remove a value from a Python list.

-- code/
-- python

people = ['Jen', 'Greg', 'Jonas']

if 'Greg' in people:
    people.remove('Greg')

print(people)

-- /code

-- results/

['Jen', 'Jonas']

-- /results

-- p

If you don't check to see if the value is in the list and try to remove one that isn't there it'll throw an error.


-- categories
-- Python 

-- metadata
-- date: 2021-03-03 20:42:39
-- id: 01ezxedc
-- status: published 
-- type: post
-- SCRUBBED_NEO: false
-- site: aws