I have a list of tuples:
[('a', 'a', 'a'), ('b', 'b', 'b), ('c',' \n \n \n ', 'c'), ('d', 'd', 'd'),('e', ' \n \n \n ', 'e']
I want to delete the tuples that contain whitespace. My code is:
for tuple in list:
for string in tuple:
if string.isspace() == True:
list.remove(tuple)
It only deletes the second of the tuples with whitespace. If I re-execute the code it deletes the other as well.