代码示例:(标识:python_set_pop)
python_set_pop.py
thisset = {"apple", "banana", "cherry"}

x = thisset.pop()

print(x) #removed item

print(thisset) #the set after removal
运行结果: