add vs update in set operations in python

前端 未结 9 603
天涯浪人
天涯浪人 2020-12-07 18:30

What is the difference between add and update operations in python if i just want to add a single value to the set.

a = set()
a.update([1]) #works
a.add(1) #         


        
9条回答
提交回复
热议问题