For example, I want to check every elements in tuple (1, 2)
are in tuple (1, 2, 3, 4, 5)
.
I don't think use loop is a good way to do it, I think it could be done in one line.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
I think you want this: ( Use all )
You can use
set.issubset
orset.issuperset
to check if every element in one tuple or list is in other.Another alternative would be to create a simple function when the set doesn't come to mind.