Reasons for demand:

Recently I have been using Python to do some small demos, especially I often use Python to do some data processing operations, so the question arises: how to make the data processing better and can directly use the case? In other words, what are python “tricks” that can help me process data quickly? Therefore, I collected some cases, combined with my actual work needs, and made these cases into continuous updates. Today, I will tell you one, that is, to remove the empty value elements in the list

Requirement objectives:

Collect core code for efficient processing of data in Python. Today, remove null elements from lists

Specific practical operation:

Removes null-valued elements from the list

Key words: for, while, remove, if

tmp_list = ['Categories of Expenditure'.'meals'.'Fund Investment'.'communication'.'borrowing'.'Traffic travel'.'Photoprint'.'favor'.' '.' '.' '.' '.' '.' '.' '.' '.' '[#]while "" inTmp_list.remove (tmp_list.remove)""Print (tmp_list) print(tmp_list) print(tmp_listfor i in tmp_list ifi ! =""Print (new_list) print(new_list)Copy the code

Conclusion: This is a continuing article that will be updated as new Python utility cases become available