How to use any generators to check a string is part of a list of other strings?

I am reading about any() in python and I am not sure how to use it.

My case is as follows: Given two lists of server names, list A and list B, I need to check if any of the names from A matches to B.

I found these two questions that is similar to what I am trying to do:

But I am not understanding the code of any() very well. Is the below what I am supposed to do with the generator?

any(X in listA for Y in listB)

means 'If any item X in listA is truthty against each item Y in listB return true?'



from Recent Questions - Stack Overflow https://ift.tt/3po9jKy
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)