<jupyter_start><jupyter_text>集合(集合是无序的)  创建集合<jupyter_code>s1 = set([1,2,3,3])
s1
s2 = set([3,4,5])
s2<jupyter_output><empty_output><jupyter_text>交集<jupyter_code>s1.intersection(s2)     #交集<jupyter_output><empty_output><jupyter_text>并集<jupyter_code>s1.union(s2)           #并集<jupyter_output><empty_output><jupyter_text>差集<jupyter_code>s1.difference(s2)       #差集<jupyter_output><empty_output><jupyter_text>包含于<jupyter_code>s1.issubset(s2)          #是否包含于<jupyter_output><empty_output><jupyter_text>包含<jupyter_code>s1.issuperset(s2)         #是否包含<jupyter_output><empty_output><jupyter_text>对称差集<jupyter_code>s1.symmetric_difference(s2)     # (s1 | s2) - (s1 & s2)  -》 s1 ^ s2<jupyter_output><empty_output><jupyter_text>增加元素<jupyter_code>s1.add(7)
s1<jupyter_output><empty_output><jupyter_text>批量增加元素<jupyter_code>s1.update([7,8,9])
s1<jupyter_output><empty_output><jupyter_text>删除元素<jupyter_code>s1.remove(7)       #存在则删除，否则抛出异常
s1
s1.discard(11)     #存在则删除，否则忽视
s1<jupyter_output><empty_output><jupyter_text>存在判断<jupyter_code>2 in s1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15145813734713076, 'fraction_numerical': 0.043273753527751646, 'mean_word_length': 9.64, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '476450', 'license': 'Apache-2.0', 'n_tokens_mistral': 570, 'n_tokens_neox': 600, 'n_words': 28, 'path': 'python/basis/jupyter/Set.ipynb', 'repo_name': 'HHW-zhou/snippets', 'size': '1063'}