custom-lists

Remove empty strings from a list except 1st one in Python

Remove empty strings from a list except 1st one in Python Question: I am trying to remove empty strings from a list except the 1st element. I have this code – my_list = [”, ‘CHANGE_TO(1)’, ‘x’, ‘x’, ‘x’, ‘x’, ‘x’, ‘1’, ”] while("" in my_list[1:]) : my_list.remove("") print(my_list) But I am not getting the desires …

Total answers: 4