{"id":5393,"date":"2022-04-02T20:45:15","date_gmt":"2022-04-02T12:45:15","guid":{"rendered":"https:\/\/egonlin.com\/?p=5393"},"modified":"2022-04-02T20:45:15","modified_gmt":"2022-04-02T12:45:15","slug":"06-02-%e5%ba%8f%e5%88%97%e7%b1%bb%e5%9e%8b%e6%93%8d%e4%bd%9c-%e5%85%83%e7%bb%84%e7%b1%bb%e5%9e%8b%e5%92%8c%e5%88%97%e8%a1%a8%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=5393","title":{"rendered":"06-02 \u5e8f\u5217\u7c7b\u578b\u64cd\u4f5c-\u5143\u7ec4\u7c7b\u578b\u548c\u5217\u8868\u7c7b\u578b"},"content":{"rendered":"<h1>\u4e00\u3001\u6982\u8981<\/h1>\n<ul>\n<li>\u5e8f\u5217\u7c7b\u578b\u5b9a\u4e49<\/li>\n<li>\u5e8f\u5217\u5904\u7406\u51fd\u6570\u53ca\u65b9\u6cd5<\/li>\n<li>\u5143\u7ec4\u7c7b\u578b\u53ca\u64cd\u4f5c<\/li>\n<li>\u5217\u8868\u7c7b\u578b\u53ca\u64cd\u4f5c<\/li>\n<li>\u5e8f\u5217\u7c7b\u578b\u5e94\u7528\u573a\u666f<\/li>\n<\/ul>\n<h1>\u4e8c\u3001\u5e8f\u5217\u7c7b\u578b\u5b9a\u4e49<\/h1>\n<p>\u5e8f\u5217\u662f\u5177\u6709\u5148\u540e\u5173\u7cfb\u7684\u4e00\u7ec4\u5143\u7d20<\/p>\n<ul>\n<li>\u5e8f\u5217\u662f\u4e00\u7ef4\u5143\u7d20\u5411\u91cf\uff0c\u5143\u7d20\u7c7b\u578b\u53ef\u4ee5\u4e0d\u540c<\/li>\n<li>\u7c7b\u4f3c\u6570\u5b66\u5143\u7d20\u5e8f\u5217\uff1a <code>s0, s1, \u2026 , sn-1<\/code><\/li>\n<li>\u5143\u7d20\u95f4\u7531\u5e8f\u53f7\u5f15\u5bfc\uff0c\u901a\u8fc7\u4e0b\u6807\u8bbf\u95ee\u5e8f\u5217\u7684\u7279\u5b9a\u5143\u7d20<\/li>\n<\/ul>\n<p>\u5e8f\u5217\u662f\u4e00\u4e2a\u57fa\u7c7b\u7c7b\u578b<\/p>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u5143\u7ec4\u7c7b\u578b\u548c\u5217\u8868\u7c7b\u578b-1.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u5143\u7ec4\u7c7b\u578b\u548c\u5217\u8868\u7c7b\u578b-1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h2>2.1 \u5e8f\u53f7\u7684\u5b9a\u4e49<\/h2>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u5143\u7ec4\u7c7b\u578b\u548c\u5217\u8868\u7c7b\u578b-2.png'><img class=\"lazyload lazyload-style-2\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  data-original=\"https:\/\/egonlin.com\/wp-content\/uploads\/2022\/04\/\u5143\u7ec4\u7c7b\u578b\u548c\u5217\u8868\u7c7b\u578b-2.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div><\/p>\n<h1>\u4e09\u3001\u5e8f\u5217\u5904\u7406\u51fd\u6570\u53ca\u65b9\u6cd5<\/h1>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u64cd\u4f5c\u7b26\u53ca\u5e94\u7528<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">x in s<\/td>\n<td style=\"text-align: center;\">\u5982\u679cx\u662f\u5e8f\u5217s\u7684\u5143\u7d20\uff0c\u8fd4\u56deTrue\uff0c\u5426\u5219\u8fd4\u56deFalse<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">x not in s<\/td>\n<td style=\"text-align: center;\">\u5982\u679cx\u662f\u5e8f\u5217s\u7684\u5143\u7d20\uff0c\u8fd4\u56deFalse\uff0c\u5426\u5219\u8fd4\u56deTrue<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s + t<\/td>\n<td style=\"text-align: center;\">\u8fde\u63a5\u4e24\u4e2a\u5e8f\u5217s\u548ct<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s<em>n \u6216 n<\/em>s<\/td>\n<td style=\"text-align: center;\">\u5c06\u5e8f\u5217s\u590d\u5236n\u6b21<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s[i]<\/td>\n<td style=\"text-align: center;\">\u7d22\u5f15\uff0c\u8fd4\u56des\u4e2d\u7684\u7b2ci\u4e2a\u5143\u7d20\uff0ci\u662f\u5e8f\u5217\u7684\u5e8f\u53f7<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s[i: j] \u6216 s[i: j: k]<\/td>\n<td style=\"text-align: center;\">\u5207\u7247\uff0c\u8fd4\u56de\u5e8f\u5217s\u4e2d\u7b2ci\u5230j\u4ee5k\u4e3a\u6b65\u957f\u7684\u5143\u7d20\u5b50\u5e8f\u5217<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>3.1 \u5e8f\u5217\u7c7b\u578b\u64cd\u4f5c\u5b9e\u4f8b<\/h2>\n<pre><code class=\"language-python\">ls = [&#039;python&#039;, 123]\nls[::-1]\n[123, &#039;python&#039;]\ns = &#039;python123&#039;\ns[::-1]\n&#039;321nohtyp&#039;<\/code><\/pre>\n<h2>3.2 \u5e8f\u5217\u7c7b\u578b\u901a\u7528\u51fd\u6570\u548c\u65b9\u6cd5<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u51fd\u6570\u548c\u65b9\u6cd5<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">len(s)<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5e8f\u5217s\u7684\u957f\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">min(s)<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5e8f\u5217s\u7684\u6700\u5c0f\u5143\u7d20\uff0cs\u4e2d\u5143\u7d20\u9700\u8981\u53ef\u6bd4\u8f83<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">max(s)<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5e8f\u5217s\u7684\u6700\u5927\u5143\u7d20\uff0cs\u4e2d\u5143\u7d20\u9700\u8981\u53ef\u6bd4\u8f83<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s.index(x) \u6216s.index(x, i, j)<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5e8f\u5217s\u4ecei\u5f00\u59cb\u5230j\u4f4d\u7f6e\u4e2d\u7b2c\u4e00\u6b21\u51fa\u73b0\u5143\u7d20x\u7684\u4f4d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">s.count(x)<\/td>\n<td style=\"text-align: center;\">\u8fd4\u56de\u5e8f\u5217s\u4e2d\u51fa\u73b0x\u7684\u603b\u6b21\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">ls = [&#039;python&#039;, 123]\nlen(ls)\n2\ns = &#039;python123&#039;\nmax(s)\n&#039;y&#039;<\/code><\/pre>\n<h1>\u56db\u3001\u5143\u7ec4\u7c7b\u578b\u53ca\u64cd\u4f5c<\/h1>\n<h2>4.1 \u5143\u7ec4\u7c7b\u578b\u5b9a\u4e49<\/h2>\n<p>\u5143\u7ec4\u662f\u5e8f\u5217\u7c7b\u578b\u7684\u4e00\u79cd\u6269\u5c55<\/p>\n<ul>\n<li>\u5143\u7ec4\u662f\u4e00\u79cd\u5e8f\u5217\u7c7b\u578b\uff0c\u4e00\u65e6\u521b\u5efa\u5c31\u4e0d\u80fd\u88ab\u4fee\u6539<\/li>\n<li>\u4f7f\u7528\u5c0f\u62ec\u53f7 () \u6216 tuple() \u521b\u5efa\uff0c\u5143\u7d20\u95f4\u7528\u9017\u53f7 , \u5206\u9694<\/li>\n<li>\u53ef\u4ee5\u4f7f\u7528\u6216\u4e0d\u4f7f\u7528\u5c0f\u62ec\u53f7<\/li>\n<\/ul>\n<pre><code class=\"language-python\">creature = &quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, &quot;human&quot;\ncreature\n(&#039;cat&#039;, &#039;dog&#039;, &#039;tiger&#039;, &#039;human&#039;)\ncolor = (0x001100, &quot;blue&quot;, creature)\ncolor\n(4352, &#039;blue&#039;, (&#039;cat&#039;, &#039;dog&#039;, &#039;tiger&#039;, &#039;human&#039;))<\/code><\/pre>\n<h2>4.2 \u5143\u7ec4\u7c7b\u578b\u64cd\u4f5c<\/h2>\n<p>\u5143\u7ec4\u7ee7\u627f\u5e8f\u5217\u7c7b\u578b\u7684\u5168\u90e8\u901a\u7528\u64cd\u4f5c<\/p>\n<ul>\n<li>\u5143\u7ec4\u7ee7\u627f\u4e86\u5e8f\u5217\u7c7b\u578b\u7684\u5168\u90e8\u901a\u7528\u64cd\u4f5c<\/li>\n<li>\u5143\u7ec4\u56e0\u4e3a\u521b\u5efa\u540e\u4e0d\u80fd\u4fee\u6539\uff0c\u56e0\u6b64\u6ca1\u6709\u7279\u6b8a\u64cd\u4f5c<\/li>\n<li>\u4f7f\u7528\u6216\u4e0d\u4f7f\u7528\u5c0f\u62ec\u53f7<\/li>\n<\/ul>\n<pre><code class=\"language-python\">creature = &quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, &quot;human&quot;\ncreature[::-1]\n(&#039;human&#039;, &#039;tiger&#039;, &#039;dog&#039;, &#039;cat&#039;)\ncolor = (0x001100, &quot;blue&quot;, creature)\ncolor[-1][2]\n&#039;tiger&#039;<\/code><\/pre>\n<h1>\u4e94\u3001\u5217\u8868\u7c7b\u578b\u53ca\u64cd\u4f5c<\/h1>\n<h2>5.1 \u5217\u8868\u7c7b\u578b\u5b9a\u4e49<\/h2>\n<p>\u5217\u8868\u662f\u5e8f\u5217\u7c7b\u578b\u7684\u4e00\u79cd\u6269\u5c55\uff0c\u5341\u5206\u5e38\u7528<\/p>\n<ul>\n<li>\u5217\u8868\u662f\u4e00\u79cd\u5e8f\u5217\u7c7b\u578b\uff0c\u521b\u5efa\u540e\u53ef\u4ee5\u968f\u610f\u88ab\u4fee\u6539<\/li>\n<li>\u4f7f\u7528\u65b9\u62ec\u53f7 [] \u6216list() \u521b\u5efa\uff0c\u5143\u7d20\u95f4\u7528\u9017\u53f7 , \u5206\u9694<\/li>\n<li>\u5217\u8868\u4e2d\u5404\u5143\u7d20\u7c7b\u578b\u53ef\u4ee5\u4e0d\u540c\uff0c\u65e0\u957f\u5ea6\u9650\u5236<\/li>\n<\/ul>\n<pre><code class=\"language-python\">ls = [&quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, 1024]\nls<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u51fd\u6570\u6216\u65b9\u6cd5<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">ls[i] = x<\/td>\n<td style=\"text-align: center;\">\u66ff\u6362\u5217\u8868ls\u7b2ci\u5143\u7d20\u4e3ax<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls[i: j: k] = lt<\/td>\n<td style=\"text-align: center;\">\u7528\u5217\u8868lt\u66ff\u6362ls\u5207\u7247\u540e\u6240\u5bf9\u5e94\u5143\u7d20\u5b50\u5217\u8868<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">del ls[i]<\/td>\n<td style=\"text-align: center;\">\u5220\u9664\u5217\u8868ls\u4e2d\u7b2ci\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">del ls[i: j: k]<\/td>\n<td style=\"text-align: center;\">\u5220\u9664\u5217\u8868ls\u4e2d\u7b2ci\u5230\u7b2cj\u4ee5k\u4e3a\u6b65\u957f\u7684\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls += lt<\/td>\n<td style=\"text-align: center;\">\u66f4\u65b0\u5217\u8868ls\uff0c\u5c06\u5217\u8868lt\u5143\u7d20\u589e\u52a0\u5230\u5217\u8868ls\u4e2d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls *= n<\/td>\n<td style=\"text-align: center;\">\u66f4\u65b0\u5217\u8868ls\uff0c\u5176\u5143\u7d20\u91cd\u590dn\u6b21<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">ls = [&quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, 1024]\nls[1:2] = [1, 2, 3, 4]\nls\n[&#039;cat&#039;, 1, 2, 3, 4, &#039;tiger&#039;, 1024]\ndel ls[::3]\nls\n[1, 2, 4, &#039;tiger&#039;]\nls * 2\n[1, 2, 4, &#039;tiger&#039;, 1, 2, 4, &#039;tiger&#039;]<\/code><\/pre>\n<h2>5.2 \u5217\u8868\u7c7b\u578b\u64cd\u4f5c\u51fd\u6570\u548c\u65b9\u6cd5<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u51fd\u6570\u6216\u65b9\u6cd5<\/th>\n<th style=\"text-align: center;\">\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">ls.append(x)<\/td>\n<td style=\"text-align: center;\">\u5728\u5217\u8868ls\u6700\u540e\u589e\u52a0\u4e00\u4e2a\u5143\u7d20x<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.clear()<\/td>\n<td style=\"text-align: center;\">\u5220\u9664\u5217\u8868ls\u4e2d\u6240\u6709\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.copy()<\/td>\n<td style=\"text-align: center;\">\u751f\u6210\u4e00\u4e2a\u65b0\u5217\u8868\uff0c\u8d4b\u503cls\u4e2d\u6240\u6709\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.insert(i,x)<\/td>\n<td style=\"text-align: center;\">\u5728\u5217\u8868ls\u7684\u7b2ci\u4f4d\u7f6e\u589e\u52a0\u5143\u7d20x<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.pop(i)<\/td>\n<td style=\"text-align: center;\">\u5c06\u5217\u8868ls\u4e2d\u7b2ci\u4f4d\u7f6e\u5143\u7d20\u53d6\u51fa\u5e76\u5220\u9664\u8be5\u5143\u7d20<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.remove(x)<\/td>\n<td style=\"text-align: center;\">\u5c06\u5217\u8868ls\u4e2d\u51fa\u73b0\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20x\u5220\u9664<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">ls.reverse()<\/td>\n<td style=\"text-align: center;\">\u5c06\u5217\u8868ls\u4e2d\u7684\u5143\u7d20\u53cd\u8f6c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-python\">ls = [&quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, 1024]\nls.append(1234)\nls\n[&#039;cat&#039;, &#039;dog&#039;, &#039;tiger&#039;, 1024, 1234]\nls.insert(3, &quot;human&quot;)\nls\n[&#039;cat&#039;, &#039;dog&#039;, &#039;tiger&#039;, &#039;human&#039;, 1024, 1234]\nls.reverse()\nls\n[1234, 1024, &#039;human&#039;, &#039;tiger&#039;, &#039;dog&#039;, &#039;cat&#039;]<\/code><\/pre>\n<h2>5.3 \u5217\u8868\u529f\u80fd\u9ed8\u5199<\/h2>\n<h3>5.3.1 \u9898\u76ee<\/h3>\n<ul>\n<li>\u5b9a\u4e49\u7a7a\u5217\u8868lt<\/li>\n<li>\u5411lt\u65b0\u589e5\u4e2a\u5143\u7d20 &#8211;&gt; lt += [1,2,3,4,5]<\/li>\n<li>\u4fee\u6539lt\u4e2d\u7b2c2\u4e2a\u5143\u7d20<\/li>\n<li>\u5411lt\u4e2d\u7b2c2\u4e2a\u4f4d\u7f6e\u589e\u52a0\u4e00\u4e2a\u5143\u7d20<\/li>\n<li>\u4ecelt\u4e2d\u7b2c1\u4e2a\u4f4d\u7f6e\u5220\u9664\u4e00\u4e2a\u5143\u7d20<\/li>\n<li>\u5220\u9664lt\u4e2d\u7b2c1-3\u4f4d\u7f6e\u5143\u7d20<\/li>\n<li>\u5224\u65adlt\u4e2d\u662f\u5426\u5305\u542b\u6570\u5b570<\/li>\n<li>\u5411lt\u65b0\u589e\u6570\u5b570<\/li>\n<li>\u8fd4\u56de\u6570\u5b570\u6240\u5728lt\u4e2d\u7684\u7d22\u5f15<\/li>\n<li>lt\u7684\u957f\u5ea6<\/li>\n<li>lt\u4e2d\u6700\u5927\u5143\u7d20<\/li>\n<li>\u6e05\u7a7alt<\/li>\n<\/ul>\n<h3>5.3.2 \u7b54\u6848<\/h3>\n<ul>\n<li>lt = []<\/li>\n<li>lt += [1,2,3,4,5]<\/li>\n<li>lt[2] = 6<\/li>\n<li>lt.insert(2, 7)<\/li>\n<li>del lt[1]<\/li>\n<li>del lt[1:4]<\/li>\n<li>0 in lt<\/li>\n<li>lt.append(0)<\/li>\n<li>lt.index(0)<\/li>\n<li>len(lt)<\/li>\n<li>max(lt)<\/li>\n<li>lt.clear()<\/li>\n<\/ul>\n<h1>\u516d\u3001\u5e8f\u5217\u7c7b\u578b\u5e94\u7528\u573a\u666f<\/h1>\n<p>\u6570\u636e\u8868\u793a\uff1a\u5143\u7ec4 \u548c \u5217\u8868<\/p>\n<ul>\n<li>\u5143\u7ec4\u7528\u4e8e\u5143\u7d20\u4e0d\u6539\u53d8\u7684\u5e94\u7528\u573a\u666f\uff0c\u66f4\u591a\u7528\u4e8e\u56fa\u5b9a\u642d\u914d\u573a\u666f<\/li>\n<li>\u5217\u8868\u66f4\u52a0\u7075\u6d3b\uff0c\u5b83\u662f\u6700\u5e38\u7528\u7684\u5e8f\u5217\u7c7b\u578b<\/li>\n<li>\u6700\u4e3b\u8981\u4f5c\u7528\uff1a\u8868\u793a\u4e00\u7ec4\u6709\u5e8f\u6570\u636e\uff0c\u8fdb\u800c\u64cd\u4f5c\u5b83\u4eec<\/li>\n<\/ul>\n<h2>6.1 \u5143\u7d20\u904d\u5386<\/h2>\n<pre><code class=\"language-python\">for item in ls\/tp :\n    &lt;\u8bed\u53e5\u5757&gt;<\/code><\/pre>\n<h2>6.2 \u6570\u636e\u4fdd\u62a4<\/h2>\n<ul>\n<li>\u5982\u679c\u4e0d\u5e0c\u671b\u6570\u636e\u88ab\u7a0b\u5e8f\u6240\u6539\u53d8\uff0c\u8f6c\u6362\u6210\u5143\u7ec4\u7c7b\u578b<\/li>\n<\/ul>\n<pre><code class=\"language-python\">ls = [&quot;cat&quot;, &quot;dog&quot;, &quot;tiger&quot;, 1024]\nlt = tuple(ls)\nlt\n(&#039;cat&#039;, &#039;dog&#039;, &#039;tiger&#039;, 1024)<\/code><\/pre>\n<h1>\u4e03\u3001\u5355\u5143\u5c0f\u7ed3<\/h1>\n<ul>\n<li>\u5e8f\u5217\u662f\u57fa\u7c7b\u7c7b\u578b\uff0c\u6269\u5c55\u7c7b\u578b\u5305\u62ec\uff1a\u5b57\u7b26\u4e32\u3001\u5143\u7ec4\u548c\u5217\u8868<\/li>\n<li>\u5143\u7ec4\u7528()\u548ctuple()\u521b\u5efa\uff0c\u5217\u8868\u7528[]\u548cset()\u521b\u5efa<\/li>\n<li>\u5143\u7ec4\u64cd\u4f5c\u4e0e\u5e8f\u5217\u64cd\u4f5c\u57fa\u672c\u76f8\u540c<\/li>\n<li>\u5217\u8868\u64cd\u4f5c\u5728\u5e8f\u5217\u64cd\u4f5c\u57fa\u7840\u4e0a\uff0c\u589e\u52a0\u4e86\u66f4\u591a\u7684\u7075\u6d3b\u6027<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u6982\u8981 \u5e8f\u5217\u7c7b\u578b\u5b9a\u4e49 \u5e8f\u5217\u5904\u7406\u51fd\u6570\u53ca\u65b9\u6cd5 \u5143\u7ec4\u7c7b\u578b\u53ca\u64cd\u4f5c \u5217\u8868\u7c7b\u578b\u53ca\u64cd\u4f5c \u5e8f\u5217\u7c7b\u578b\u5e94\u7528\u573a\u666f \u4e8c\u3001\u5e8f\u5217\u7c7b\u578b\u5b9a\u4e49 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5394,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[371,377],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5393"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5393"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/5393\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/5394"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}