{"id":576,"date":"2025-10-23T15:19:49","date_gmt":"2025-10-23T07:19:49","guid":{"rendered":"http:\/\/www.pyteam.cn\/?p=576"},"modified":"2025-10-23T15:19:49","modified_gmt":"2025-10-23T07:19:49","slug":"python3-%e9%9b%86%e5%90%88","status":"publish","type":"post","link":"http:\/\/www.pyteam.cn\/index.php\/2025\/10\/23\/python3-%e9%9b%86%e5%90%88\/","title":{"rendered":"Python3 \u96c6\u5408"},"content":{"rendered":"\n<p>\u96c6\u5408\uff08set\uff09\u662f\u4e00\u4e2a\u65e0\u5e8f\u7684\u4e0d\u91cd\u590d\u5143\u7d20\u5e8f\u5217\u3002<\/p>\n\n\n\n<p>\u96c6\u5408\u4e2d\u7684\u5143\u7d20\u4e0d\u4f1a\u91cd\u590d\uff0c\u5e76\u4e14\u53ef\u4ee5\u8fdb\u884c\u4ea4\u96c6\u3001\u5e76\u96c6\u3001\u5dee\u96c6\u7b49\u5e38\u89c1\u7684\u96c6\u5408\u64cd\u4f5c\u3002<\/p>\n\n\n\n<p>\u53ef\u4ee5\u4f7f\u7528\u5927\u62ec\u53f7&nbsp;<strong>{ }<\/strong>&nbsp;\u521b\u5efa\u96c6\u5408\uff0c\u5143\u7d20\u4e4b\u95f4\u7528\u9017\u53f7&nbsp;<strong>,<\/strong>&nbsp;\u5206\u9694\uff0c \u6216\u8005\u4e5f\u53ef\u4ee5\u4f7f\u7528&nbsp;<strong>set()<\/strong>&nbsp;\u51fd\u6570\u521b\u5efa\u96c6\u5408\u3002<\/p>\n\n\n\n<p><strong>\u521b\u5efa\u683c\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">parame = {value01,value02,...}\n\u6216\u8005\nset(value)<\/pre>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u5b9e\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">set1 = {1, 2, 3, 4}            # \u76f4\u63a5\u4f7f\u7528\u5927\u62ec\u53f7\u521b\u5efa\u96c6\u5408\nset2 = set([4, 5, 6, 7])      # \u4f7f\u7528 set() \u51fd\u6570\u4ece\u5217\u8868\u521b\u5efa\u96c6\u5408<\/pre>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u521b\u5efa\u4e00\u4e2a\u7a7a\u96c6\u5408\u5fc5\u987b\u7528<strong>&nbsp;set()<\/strong>&nbsp;\u800c\u4e0d\u662f&nbsp;<strong>{ }<\/strong>\uff0c\u56e0\u4e3a&nbsp;<strong>{ }<\/strong>&nbsp;\u662f\u7528\u6765\u521b\u5efa\u4e00\u4e2a\u7a7a\u5b57\u5178\u3002<\/p>\n\n\n\n<p>\u66f4\u591a\u5b9e\u4f8b\u6f14\u793a\uff1a<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;basket&nbsp;=&nbsp;{&#8216;apple&#8217;,&nbsp;&#8216;orange&#8217;,&nbsp;&#8216;apple&#8217;,&nbsp;&#8216;pear&#8217;,&nbsp;&#8216;orange&#8217;,&nbsp;&#8216;banana&#8217;}<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(basket)&nbsp;# \u8fd9\u91cc\u6f14\u793a\u7684\u662f\u53bb\u91cd\u529f\u80fd<br>{&#8216;orange&#8217;,&nbsp;&#8216;banana&#8217;,&nbsp;&#8216;pear&#8217;,&nbsp;&#8216;apple&#8217;}<br>&gt;&gt;&gt;&nbsp;&#8216;orange&#8217;&nbsp;<strong>in<\/strong>&nbsp;basket &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;# \u5feb\u901f\u5224\u65ad\u5143\u7d20\u662f\u5426\u5728\u96c6\u5408\u5185<br>True<br>&gt;&gt;&gt;&nbsp;&#8216;crabgrass&#8217;&nbsp;<strong>in<\/strong>&nbsp;basket<br>False<\/p>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;# \u4e0b\u9762\u5c55\u793a\u4e24\u4e2a\u96c6\u5408\u95f4\u7684\u8fd0\u7b97.<br>&#8230;<br>&gt;&gt;&gt;&nbsp;a&nbsp;=&nbsp;set(&#8216;abracadabra&#8217;)<br>&gt;&gt;&gt;&nbsp;b&nbsp;=&nbsp;set(&#8216;alacazam&#8217;)<br>&gt;&gt;&gt;&nbsp;a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>{&#8216;a&#8217;,&nbsp;&#8216;r&#8217;,&nbsp;&#8216;b&#8217;,&nbsp;&#8216;c&#8217;,&nbsp;&#8216;d&#8217;}<br>&gt;&gt;&gt;&nbsp;a &#8211; b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u96c6\u5408a\u4e2d\u5305\u542b\u800c\u96c6\u5408b\u4e2d\u4e0d\u5305\u542b\u7684\u5143\u7d20<br>{&#8216;r&#8217;,&nbsp;&#8216;d&#8217;,&nbsp;&#8216;b&#8217;}<br>&gt;&gt;&gt;&nbsp;a | b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u96c6\u5408a\u6216b\u4e2d\u5305\u542b\u7684\u6240\u6709\u5143\u7d20<br>{&#8216;a&#8217;,&nbsp;&#8216;c&#8217;,&nbsp;&#8216;r&#8217;,&nbsp;&#8216;d&#8217;,&nbsp;&#8216;b&#8217;,&nbsp;&#8216;m&#8217;,&nbsp;&#8216;z&#8217;,&nbsp;&#8216;l&#8217;}<br>&gt;&gt;&gt;&nbsp;a &amp; b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u96c6\u5408a\u548cb\u4e2d\u90fd\u5305\u542b\u4e86\u7684\u5143\u7d20<br>{&#8216;a&#8217;,&nbsp;&#8216;c&#8217;}<br>&gt;&gt;&gt;&nbsp;a ^ b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# \u4e0d\u540c\u65f6\u5305\u542b\u4e8ea\u548cb\u7684\u5143\u7d20<br>{&#8216;r&#8217;,&nbsp;&#8216;d&#8217;,&nbsp;&#8216;b&#8217;,&nbsp;&#8216;m&#8217;,&nbsp;&#8216;z&#8217;,&nbsp;&#8216;l&#8217;}<\/p>\n\n\n\n<p>\u7c7b\u4f3c\u5217\u8868\u63a8\u5bfc\u5f0f\uff0c\u540c\u6837\u96c6\u5408\u652f\u6301\u96c6\u5408\u63a8\u5bfc\u5f0f(Set comprehension):<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;a&nbsp;=&nbsp;{x&nbsp;<strong>for<\/strong>&nbsp;x&nbsp;<strong>in<\/strong>&nbsp;&#8216;abracadabra&#8217;&nbsp;<strong>if<\/strong>&nbsp;x&nbsp;<strong>not<\/strong>&nbsp;<strong>in<\/strong>&nbsp;&#8216;abc&#8217;}<br>&gt;&gt;&gt;&nbsp;a<br>{&#8216;r&#8217;,&nbsp;&#8216;d&#8217;}<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u96c6\u5408\u7684\u57fa\u672c\u64cd\u4f5c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1\u3001\u6dfb\u52a0\u5143\u7d20<\/h3>\n\n\n\n<p><strong>\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.add( x )<\/pre>\n\n\n\n<p>\u5c06\u5143\u7d20 x \u6dfb\u52a0\u5230\u96c6\u5408 s \u4e2d\uff0c\u5982\u679c\u5143\u7d20\u5df2\u5b58\u5728\uff0c\u5219\u4e0d\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;thisset.add(&#8220;Facebook&#8221;)<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>{&#8216;Taobao&#8217;,&nbsp;&#8216;Facebook&#8217;,&nbsp;&#8216;Google&#8217;,&nbsp;&#8216;Runoob&#8217;}<\/p>\n\n\n\n<p>\u8fd8\u6709\u4e00\u4e2a\u65b9\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u6dfb\u52a0\u5143\u7d20\uff0c\u4e14\u53c2\u6570\u53ef\u4ee5\u662f\u5217\u8868\uff0c\u5143\u7ec4\uff0c\u5b57\u5178\u7b49\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.update( x )<\/pre>\n\n\n\n<p>x \u53ef\u4ee5\u6709\u591a\u4e2a\uff0c\u7528\u9017\u53f7\u5206\u5f00\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;thisset.update({1,3})<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>{1,&nbsp;3,&nbsp;&#8216;Google&#8217;,&nbsp;&#8216;Taobao&#8217;,&nbsp;&#8216;Runoob&#8217;}<br>&gt;&gt;&gt;&nbsp;thisset.update([1,4],[5,6])&nbsp;<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>{1,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;&#8216;Google&#8217;,&nbsp;&#8216;Taobao&#8217;,&nbsp;&#8216;Runoob&#8217;}<br>&gt;&gt;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2\u3001\u79fb\u9664\u5143\u7d20<\/h3>\n\n\n\n<p><strong>\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.remove( x )<\/pre>\n\n\n\n<p>\u5c06\u5143\u7d20 x \u4ece\u96c6\u5408 s \u4e2d\u79fb\u9664\uff0c\u5982\u679c\u5143\u7d20\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u53d1\u751f\u9519\u8bef\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;thisset.remove(&#8220;Taobao&#8221;)<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>{&#8216;Google&#8217;,&nbsp;&#8216;Runoob&#8217;}<br>&gt;&gt;&gt;&nbsp;thisset.remove(&#8220;Facebook&#8221;)&nbsp;&nbsp;# \u4e0d\u5b58\u5728\u4f1a\u53d1\u751f\u9519\u8bef<br>Traceback&nbsp;(most recent call last):<br>&nbsp; File&nbsp;&#8220;&lt;stdin&gt;&#8221;,&nbsp;line&nbsp;1,&nbsp;<strong>in<\/strong>&nbsp;&lt;module&gt;<br>KeyError:&nbsp;&#8216;Facebook&#8217;<br>&gt;&gt;&gt;<\/p>\n\n\n\n<p>\u6b64\u5916\u8fd8\u6709\u4e00\u4e2a\u65b9\u6cd5\u4e5f\u662f\u79fb\u9664\u96c6\u5408\u4e2d\u7684\u5143\u7d20\uff0c\u4e14\u5982\u679c\u5143\u7d20\u4e0d\u5b58\u5728\uff0c\u4e0d\u4f1a\u53d1\u751f\u9519\u8bef\u3002\u683c\u5f0f\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.discard( x )<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;thisset.discard(&#8220;Facebook&#8221;)&nbsp;# \u4e0d\u5b58\u5728\u4e0d\u4f1a\u53d1\u751f\u9519\u8bef<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>{&#8216;Taobao&#8217;,&nbsp;&#8216;Google&#8217;,&nbsp;&#8216;Runoob&#8217;}<\/p>\n\n\n\n<p>\u6211\u4eec\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u968f\u673a\u5220\u9664\u96c6\u5408\u4e2d\u7684\u4e00\u4e2a\u5143\u7d20\uff0c\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.pop() <\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u811a\u672c\u6a21\u5f0f\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;,&nbsp;&#8220;Facebook&#8221;))<br>x&nbsp;=&nbsp;thisset.pop()<\/p>\n\n\n\n<p><strong>print<\/strong>(x)<\/p>\n\n\n\n<p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Runoob<\/pre>\n\n\n\n<p>\u591a\u6b21\u6267\u884c\u6d4b\u8bd5\u7ed3\u679c\u90fd\u4e0d\u4e00\u6837\u3002<\/p>\n\n\n\n<p>set \u96c6\u5408\u7684 pop \u65b9\u6cd5\u4f1a\u5bf9\u96c6\u5408\u8fdb\u884c\u65e0\u5e8f\u7684\u6392\u5217\uff0c\u7136\u540e\u5c06\u8fd9\u4e2a\u65e0\u5e8f\u6392\u5217\u96c6\u5408\u7684\u5de6\u9762\u7b2c\u4e00\u4e2a\u5143\u7d20\u8fdb\u884c\u5220\u9664\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3\u3001\u8ba1\u7b97\u96c6\u5408\u5143\u7d20\u4e2a\u6570<\/h3>\n\n\n\n<p><strong>\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">len(s)<\/pre>\n\n\n\n<p>\u8ba1\u7b97\u96c6\u5408 s \u5143\u7d20\u4e2a\u6570\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;len(thisset)<br>3<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4\u3001\u6e05\u7a7a\u96c6\u5408<\/h3>\n\n\n\n<p><strong>\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">s.clear()<\/pre>\n\n\n\n<p>\u6e05\u7a7a\u96c6\u5408 s\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;thisset.clear()<br>&gt;&gt;&gt;&nbsp;<strong>print<\/strong>(thisset)<br>set()<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5\u3001\u5224\u65ad\u5143\u7d20\u662f\u5426\u5728\u96c6\u5408\u4e2d\u5b58\u5728<\/h3>\n\n\n\n<p><strong>\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">x in s<\/pre>\n\n\n\n<p>\u5224\u65ad\u5143\u7d20 x \u662f\u5426\u5728\u96c6\u5408 s \u4e2d\uff0c\u5b58\u5728\u8fd4\u56de True\uff0c\u4e0d\u5b58\u5728\u8fd4\u56de False\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b(Python 3.0+)<\/h2>\n\n\n\n<p>&gt;&gt;&gt;&nbsp;thisset&nbsp;=&nbsp;set((&#8220;Google&#8221;,&nbsp;&#8220;Runoob&#8221;,&nbsp;&#8220;Taobao&#8221;))<br>&gt;&gt;&gt;&nbsp;&#8220;Runoob&#8221;&nbsp;<strong>in<\/strong>&nbsp;thisset<br>True<br>&gt;&gt;&gt;&nbsp;&#8220;Facebook&#8221;&nbsp;<strong>in<\/strong>&nbsp;thisset<br>False<br>&gt;&gt;&gt;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"setmethod\">\u96c6\u5408\u5185\u7f6e\u65b9\u6cd5\u5b8c\u6574\u5217\u8868<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u65b9\u6cd5<\/th><th>\u63cf\u8ff0<\/th><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-add.html\" target=\"_blank\" rel=\"noreferrer noopener\">add()<\/a><\/td><td>\u4e3a\u96c6\u5408\u6dfb\u52a0\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-clear.html\" target=\"_blank\" rel=\"noreferrer noopener\">clear()<\/a><\/td><td>\u79fb\u9664\u96c6\u5408\u4e2d\u7684\u6240\u6709\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-copy.html\" target=\"_blank\" rel=\"noreferrer noopener\">copy()<\/a><\/td><td>\u62f7\u8d1d\u4e00\u4e2a\u96c6\u5408<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-difference.html\" target=\"_blank\" rel=\"noreferrer noopener\">difference()<\/a><\/td><td>\u8fd4\u56de\u591a\u4e2a\u96c6\u5408\u7684\u5dee\u96c6<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-difference_update.html\" target=\"_blank\" rel=\"noreferrer noopener\">difference_update()<\/a><\/td><td>\u79fb\u9664\u96c6\u5408\u4e2d\u7684\u5143\u7d20\uff0c\u8be5\u5143\u7d20\u5728\u6307\u5b9a\u7684\u96c6\u5408\u4e5f\u5b58\u5728\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-discard.html\" target=\"_blank\" rel=\"noreferrer noopener\">discard()<\/a><\/td><td>\u5220\u9664\u96c6\u5408\u4e2d\u6307\u5b9a\u7684\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-intersection.html\" target=\"_blank\" rel=\"noreferrer noopener\">intersection()<\/a><\/td><td>\u8fd4\u56de\u96c6\u5408\u7684\u4ea4\u96c6<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-intersection_update.html\" target=\"_blank\" rel=\"noreferrer noopener\">intersection_update()<\/a><\/td><td>\u8fd4\u56de\u96c6\u5408\u7684\u4ea4\u96c6\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-isdisjoint.html\" target=\"_blank\" rel=\"noreferrer noopener\">isdisjoint()<\/a><\/td><td>\u5224\u65ad\u4e24\u4e2a\u96c6\u5408\u662f\u5426\u5305\u542b\u76f8\u540c\u7684\u5143\u7d20\uff0c\u5982\u679c\u6ca1\u6709\u8fd4\u56de True\uff0c\u5426\u5219\u8fd4\u56de False\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-issubset.html\" target=\"_blank\" rel=\"noreferrer noopener\">issubset()<\/a><\/td><td>\u5224\u65ad\u6307\u5b9a\u96c6\u5408\u662f\u5426\u4e3a\u8be5\u65b9\u6cd5\u53c2\u6570\u96c6\u5408\u7684\u5b50\u96c6\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-issuperset.html\" target=\"_blank\" rel=\"noreferrer noopener\">issuperset()<\/a><\/td><td>\u5224\u65ad\u8be5\u65b9\u6cd5\u7684\u53c2\u6570\u96c6\u5408\u662f\u5426\u4e3a\u6307\u5b9a\u96c6\u5408\u7684\u5b50\u96c6<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-pop.html\" target=\"_blank\" rel=\"noreferrer noopener\">pop()<\/a><\/td><td>\u968f\u673a\u79fb\u9664\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-remove.html\" target=\"_blank\" rel=\"noreferrer noopener\">remove()<\/a><\/td><td>\u79fb\u9664\u6307\u5b9a\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-symmetric_difference.html\" target=\"_blank\" rel=\"noreferrer noopener\">symmetric_difference()<\/a><\/td><td>\u8fd4\u56de\u4e24\u4e2a\u96c6\u5408\u4e2d\u4e0d\u91cd\u590d\u7684\u5143\u7d20\u96c6\u5408\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-symmetric_difference_update.html\" target=\"_blank\" rel=\"noreferrer noopener\">symmetric_difference_update()<\/a><\/td><td>\u79fb\u9664\u5f53\u524d\u96c6\u5408\u4e2d\u5728\u53e6\u5916\u4e00\u4e2a\u6307\u5b9a\u96c6\u5408\u76f8\u540c\u7684\u5143\u7d20\uff0c\u5e76\u5c06\u53e6\u5916\u4e00\u4e2a\u6307\u5b9a\u96c6\u5408\u4e2d\u4e0d\u540c\u7684\u5143\u7d20\u63d2\u5165\u5230\u5f53\u524d\u96c6\u5408\u4e2d\u3002<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-union.html\" target=\"_blank\" rel=\"noreferrer noopener\">union()<\/a><\/td><td>\u8fd4\u56de\u4e24\u4e2a\u96c6\u5408\u7684\u5e76\u96c6<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/ref-set-update.html\" target=\"_blank\" rel=\"noreferrer noopener\">update()<\/a><\/td><td>\u7ed9\u96c6\u5408\u6dfb\u52a0\u5143\u7d20<\/td><\/tr><tr><td><a href=\"https:\/\/www.runoob.com\/python3\/python3-string-len.html\" target=\"_blank\" rel=\"noreferrer noopener\">len()<\/a><\/td><td>\u8ba1\u7b97\u96c6\u5408\u5143\u7d20\u4e2a\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u96c6\u5408\uff08set\uff09\u662f\u4e00\u4e2a\u65e0\u5e8f\u7684\u4e0d\u91cd\u590d\u5143\u7d20\u5e8f\u5217\u3002 \u96c6\u5408\u4e2d\u7684\u5143\u7d20\u4e0d\u4f1a\u91cd\u590d\uff0c\u5e76&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":484,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-576","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-1"],"views":641,"_links":{"self":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/comments?post=576"}],"version-history":[{"count":1,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/576\/revisions"}],"predecessor-version":[{"id":577,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/posts\/576\/revisions\/577"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media\/484"}],"wp:attachment":[{"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/media?parent=576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/categories?post=576"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pyteam.cn\/index.php\/wp-json\/wp\/v2\/tags?post=576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}