Creating an empty set

后端 未结 4 2082
刺人心
刺人心 2021-01-03 23:15

I have some code which tots up a set of selected values. I would like to define an empty set and add to it, but {} keeps turning into a dictionary. I have foun

4条回答
  •  萌比男神i
    2021-01-03 23:47

    The "proper" way to do it:

    myset = set()
    

    The {...} notation cannot be used to initialize an empty set

提交回复
热议问题