您的位置:首页 > 编程语言 > Python开发

从字符串列表中删除空字符串 - Remove empty strings from a list of strings

2020-07-14 06:54 1136 查看

精选30+云产品,助力企业轻松上云!>>>

问题:

I want to remove all empty strings from a list of strings in python. 我想从python中的字符串列表中删除所有空字符串。

My idea looks like this: 我的想法如下:

while '' in str_list:
str_list.remove('')

Is there any more pythonic way to do this? 有没有更多的Python方式可以做到这一点?

解决方案:

参考一: https://stackoom.com/question/G8Mx/从字符串列表中删除空字符串
参考二: https://oldbug.net/q/G8Mx/Remove-empty-strings-from-a-list-of-strings
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python
相关文章推荐