‘‘‘
The function of the collection and the Good helper, the collection is also unordered & intersection | Set- Difference set ^ symmetric difference set
Collection additions and deletions change
‘‘‘
List_1 =[1,2,3,4,5,6,3,7,9,2]
List2=set ([1,2,11,121,211])
List_1=set (list_1)
#print (List_1,type (list_1))
Print (LIST_1,LIST2)
"' Intersection--the same element determines if there is an intersection isdisjoint () ' '
Print (List_1.intersection (LIST2))
Print (List_1 & List2)
"Take and set"
Print (List_1.union (LIST2))
Print (list_1 | list2)
"Take the difference set in list_1 and not in List2 '"
Print (List_1.difference (LIST2))
Print (LIST_1-LIST2)
"' judgment is not a subset in turn can see if there is a parent issupsubset ' '
Print (List_1.issubset (LIST2))
"Reverse differential set"
Print (List_1.symmetric_difference (LIST2))
Print (LIST_1^LIST2)
' Add ' '
List_1.add (1000000)
List_1.update ([888,777,666,555])
Print (list_1)
' Delete '
Print (List_1.pop ())
Print (List_1.pop ())
Print (List_1.pop ())
Print (List_1.pop ())
' Take the set length '
Print (len (list_1))
"x in Y to determine if x is in Y"
python--Base Collection