What happens when you run that code is that you're telling python to keep looping while a[0] (the first element of the list a) exists. Each time the loop runs you remove the current first element from the list. When there are no more elements to remove python throws exception at your while a[0] condition.
To avoid this you can do the following:
a = [1,2,3,4,5,6,7,8,9]
try:
while a[0]:
print "removing the element:", a[0]
a.remove(a[0])
except IndexError:
print "no more elements to remove."
This will smoothly handle the error message.
or you could have:
while len(a) > 0:
which will only run as long as your list contains at least one element.
Note that trying to print what you're doing can often help you debug your code.
You can read this discussion: