Use curly braces to initialize a Set in Python

前端 未结 4 1198
别跟我提以往
别跟我提以往 2020-12-13 11:47

I\'m learning python, and I have a novice question about initializing sets. Through testing, I\'ve discovered that a set can be initialized like so:

my_set          


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 12:30

    You need to do empty_set = set() to initialize an empty set. {} is an empty dict.

提交回复
热议问题