要打印集合中的元素,可以使用for循环遍历集合并打印每个元素。例如:
my_set = {1, 2, 3, 4, 5} for element in my_set: print(element)
这将逐个打印集合中的每个元素:
1 2 3 4 5