description
set () function creates an unordered set of elements is not repeated, the relationship can be tested, deduplication may also be calculated intersection, difference, and sets the like.
grammar
set syntax:
class set([iterable])
Parameter Description:
iterable -- 可迭代对象对象;
return value
Returns a new collection object.
Examples
The following example shows how to use the set of:
X = SET ( 'runoob')
Y = SET ( 'Google')
X, Y
(SET ([ 'B', 'R & lt', 'U', 'O', 'n-']), SET ([ 'E ',' o ',' g ',' l '])) # repeats has been deletedx & y # intersection
set ([ 'o'])x | y # union
set ([ 'b', ' e', 'g', 'l', 'o', 'n', 'r', 'u'])x - y # difference sets
set ([ 'r', ' b', 'u', 'n'])