python study notes thirteen (set)

set: Similarly dict, is a set of key is not stored value
essentially: unordered and no duplicate elements
1. Create a set
Create a list or set need dict tuple or as a set of inputs, repeating elements in the set will be automatically filter
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
2. Add the Add ()
Here Insert Picture Description
Here Insert Picture Description
3. insert update ()
insert the whole list, tuple, string, breaking insert
Here Insert Picture Description
4. remove remove ()
delete elements which to write the value of which element
Here Insert Picture Description
5. the traversal
Here Insert Picture Description
set is no index
6. and set the intersection of two sets and
Here Insert Picture Description
7. type conversion
(1) list converted into set
Here Insert Picture Description
(2) converted into tuple set
Here Insert Picture Description
(. 3) set to turn List
Here Insert Picture Description
8.list deduplication
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_38324954/article/details/95062511