How to implement query by python
This article mainly shows you "how python realizes query", the content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "how python realizes query".
query
Sort and query are good friends, long data structure inside (dictionary, list) inside we will have query, filter requirements. Sometimes, we need to find a certain element or a certain type of element from a long list. How to do it is very simple. Use the advanced function filter :
1). lambda filter
Comments:lambda is a very concise expression of the function, short and concise, coupled with the use of filter, very beautiful. For example, we use the startswith built-in function in the string to filter out the data we need in the list very conveniently! (Python3 slightly changed and added a list in addition to filter, otherwise the generated iterator address)
Comments: regular is a very good filtering method, sometimes a good regular top dozens of lines of code, proficient in regular play data analysis, data cleaning is a necessary skill!
The above is all the content of this article "how python implements queries", thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!