Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

remove empty strings from a list of strings

Asked by Alex Duncan Jun 9, 2021 1.4K views 1 answer
Share

About this question

 I want to remove all empty strings from a list of strings in python.

My idea looks like this:

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

Is there any more pythonic way to remove empty strings from the list python?

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.