Python indexing starts from zero so I adjusted your w_index list.
w_index = [0,2]
Also, str is a special name in Python so I renamed your string variable.
string = 'a b c d'
Now create a new list wpos that gives the position of each whitespace in string.
wpos = [i for (i, char) in enumerate(str) if char == ' ']
print "wpos:", wpos
Output:
>> wpos: [1, 3, 5]
We can then loop through w_index in reverse and remove the whitespace by it's position. We can't pop() a string like we can a list, so split the string in two and combine it back together to make a new string.
for i in w_index[::-1]:
pos = wpos[i]
string = string[:pos] + string[(pos+1):]
print string
Output:
>> ab cd