Python🐍

python - set

2021-01-25  本文已影响0人  Pingouin

set

set的应用

  1. 找到list,file中的unique elements
  2. 找到various combinations of elements using the set operators.

Sets are unordered collections of unique items, just like mathematical sets.
Sets are specified by curly braces—like dictionaries, but there are no colons.
Common mathematical set operations are supported. For A = {'a','b','c','d'} and B = {'c','d','e','f'}:

{1,2,3} == {1,3,2}
set.add()
set.remove()
上一篇 下一篇

猜你喜欢

热点阅读