my_set = {1, 2, 3}
my_set.add(4)
print(my_set) # Output: {1, 2, 3, 4}
my_set = {1, 2, 3}
my_set.remove(2)
print(my_set) # Output: {1, 3}
my_set = {1, 2, 3}
my_set.clear()
print(my_set) # Output: set()
set1 = {1, 2, 3}
set2 = {2, 3, 4}
intersection_set = set1.intersection(set2)
print(intersection_set) # Output: {2, 3}
set1 = {1, 2, 3}
set2 = {2, 3, 4}
union_set = set1.union(set2)
print(union_set) # Output: {1, 2, 3, 4}
set1 = {1, 2, 3}
set2 = {2, 3, 4}
difference_set = set1.difference(set2)
print(difference_set) # Output: {1}
这些是set常用的操作,还有其他一些操作可以参考Python官方文档。