공부
[Python] remove "" filter(None, lst)
승가비
2022. 6. 6. 02:55
728x90
>>> lst = ["He", "is", "so", "", "cool"]
>>> filter(None, lst)
['He', 'is', 'so', 'cool']
https://stackoverflow.com/questions/16099694/how-to-remove-empty-string-in-a-list
How to remove empty string in a list?
For example I have a sentence "He is so .... cool!" Then I remove all the punctuation and make it in a list. ["He", "is", "so", "", "cool"] How do I remove or ignore the empty string?
stackoverflow.com
728x90