How to get the complement of two sets by python
In this article, the editor introduces in detail "python how to get the complement of the two sets", the content is detailed, the steps are clear, and the details are handled properly. I hope that this "python how to get the complement of the two sets" article can help you solve your doubts.
The details are as follows:
Set () syntax
Class set ([iterable])
Parameter description:
Iterable: iterable object object
Example:
> x = set ('runoob')
> y = set ('google')
> > x, y
(set (['baked,' rented, 'upright,' oiled,'n']), set (['eyed,' oiled, 'grubbed,' l'])) # duplicated deletion
> x & y # intersection
Set (['o'])
> x | y # Union
Set (['baked,' estranged, 'grubbed,' lumped, 'oily,' nasty, 'ritual,' u'])
X-y # subtraction (complement)
Set (['ritual,' baked, 'upright,' n'])
After reading this, the article "how to get the complement of two collections by python" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.