Remove an item from a list with slicing
You can remove an item from a list by assigning it's position to an empty list:
a = [1,2,3,4,5]
a[2:3] = []
print a
[1, 2, 4, 5]
Written by Chris Seymour
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Related Tags
#python
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#