"del" allows you to delete elements from a list for example...

# Makes list, note in python when addressing an element, the first element is 0, the second is 1. 

a = [1,2,3,4]
#   [0,1,2,3] shows how python "reads" the location.


# Prints elements in list a
print a

# deletes the "first" element which is element 0
del a[0]

# prints the elements in list a, minus the original 1 value in the 0 place.
print a

Lots more specifics at
http://learnpythonthehardway.org/book/ex34.html

You can expand that with slicing ...

# using del and slicing on a list

ar = range(7)

print ar  # [0, 1, 2, 3, 4, 5, 6]

# delete element 1 and 2
del ar[1:3]

print ar  # [0, 3, 4, 5, 6]

ar = range(7)

# delete every second element
del ar[::2]

print ar  # [1, 3, 5]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.