{"id":1170602,"date":"2025-01-15T16:24:38","date_gmt":"2025-01-15T08:24:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1170602.html"},"modified":"2025-01-15T16:24:40","modified_gmt":"2025-01-15T08:24:40","slug":"python%e5%a6%82%e4%bd%95%e7%9b%b4%e6%8e%a5%e8%be%93%e5%85%a5%e5%88%97%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1170602.html","title":{"rendered":"python\u5982\u4f55\u76f4\u63a5\u8f93\u5165\u5217\u8868"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26073158\/38cdf5ff-4571-48b1-9461-33258debdb2d.webp\" alt=\"python\u5982\u4f55\u76f4\u63a5\u8f93\u5165\u5217\u8868\" \/><\/p>\n<p><p> <strong>Python\u4e2d\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u76f4\u63a5\u8f93\u5165\u5217\u8868<\/strong>\u3001<strong>\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u65b9\u62ec\u53f7<\/strong>\u3001<strong>\u8fd8\u53ef\u4ee5\u901a\u8fc7<code>list()<\/code>\u51fd\u6570\u548c<code>range()<\/code>\u51fd\u6570\u521b\u5efa\u5217\u8868<\/strong>\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u65b9\u62ec\u53f7<code>[]<\/code>\u3002\u4f8b\u5982\uff0c<code>my_list = [1, 2, 3, 4, 5]<\/code>\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7<code>list()<\/code>\u51fd\u6570\u4ece\u5176\u4ed6\u53ef\u8fed\u4ee3\u5bf9\u8c61\u521b\u5efa\u5217\u8868\uff0c\u4f8b\u5982<code>my_list = list(range(1, 6))<\/code>\u3002\u5728\u8fd9\u4e9b\u65b9\u6cd5\u4e2d\uff0c\u4f7f\u7528\u65b9\u62ec\u53f7\u662f\u6700\u76f4\u63a5\u548c\u7b80\u6d01\u7684\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u65b9\u62ec\u53f7\u76f4\u63a5\u8f93\u5165\u5217\u8868<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528\u65b9\u62ec\u53f7\u76f4\u63a5\u8f93\u5165\u5217\u8868\u662fPython\u4e2d\u6700\u5e38\u89c1\u548c\u7b80\u6d01\u7684\u65b9\u5f0f\u3002\u901a\u8fc7\u7b80\u5355\u5730\u5c06\u5143\u7d20\u653e\u5728\u65b9\u62ec\u53f7\u4e2d\u5e76\u7528\u9017\u53f7\u5206\u9694\uff0c\u5c31\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u8981\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6570\u5b57\u7684\u5217\u8868\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(my_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5]<\/code>\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4efb\u610f\u6570\u91cf\u5143\u7d20\u7684\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e0d\u540c\u6570\u636e\u7c7b\u578b\u7684\u5217\u8868<\/h3>\n<\/p>\n<p><p>Python\u7684\u5217\u8868\u53ef\u4ee5\u5305\u542b\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\uff0c\u4f8b\u5982\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u548c\u5e03\u5c14\u503c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">mixed_list = [1, &quot;hello&quot;, 3.14, True]<\/p>\n<p>print(mixed_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, &#39;hello&#39;, 3.14, True]<\/code>\u3002\u8fd9\u79cd\u7075\u6d3b\u6027\u4f7f\u5f97Python\u7684\u5217\u8868\u975e\u5e38\u5f3a\u5927\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528<code>list()<\/code>\u51fd\u6570\u521b\u5efa\u5217\u8868<\/h2>\n<\/p>\n<p><p><code>list()<\/code>\u51fd\u6570\u53ef\u4ee5\u5c06\u5176\u4ed6\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff08\u5982\u5b57\u7b26\u4e32\u3001\u5143\u7ec4\u6216\u96c6\u5408\uff09\u8f6c\u6362\u4e3a\u5217\u8868\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u5408\u4ece\u73b0\u6709\u7684\u6570\u636e\u7ed3\u6784\u521b\u5efa\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u4ece\u5b57\u7b26\u4e32\u521b\u5efa\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c06\u4e00\u4e2a\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u4e00\u4e2a\u5305\u542b\u6bcf\u4e2a\u5b57\u7b26\u7684\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">string = &quot;hello&quot;<\/p>\n<p>string_list = list(string)<\/p>\n<p>print(string_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[&#39;h&#39;, &#39;e&#39;, &#39;l&#39;, &#39;l&#39;, &#39;o&#39;]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u4ece\u5143\u7ec4\u521b\u5efa\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u540c\u6837\u5730\uff0c\u53ef\u4ee5\u5c06\u4e00\u4e2a\u5143\u7ec4\u8f6c\u6362\u4e3a\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">tuple_data = (1, 2, 3, 4, 5)<\/p>\n<p>tuple_list = list(tuple_data)<\/p>\n<p>print(tuple_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528<code>range()<\/code>\u51fd\u6570\u521b\u5efa\u5217\u8868<\/h2>\n<\/p>\n<p><p><code>range()<\/code>\u51fd\u6570\u901a\u5e38\u7528\u4e8e\u751f\u6210\u4e00\u4e2a\u6570\u5b57\u5e8f\u5217\uff0c\u5e76\u4e14\u53ef\u4ee5\u4e0e<code>list()<\/code>\u51fd\u6570\u7ed3\u5408\u4f7f\u7528\u6765\u521b\u5efa\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u4ece0\u52309\u7684\u6570\u5b57\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>range()<\/code>\u51fd\u6570\u751f\u6210\u4ece0\u52309\u7684\u6570\u5b57\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">range_list = list(range(10))<\/p>\n<p>print(range_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u6307\u5b9a\u8303\u56f4\u548c\u6b65\u957f<\/h3>\n<\/p>\n<p><p><code>range()<\/code>\u51fd\u6570\u5141\u8bb8\u6307\u5b9a\u8d77\u59cb\u503c\u3001\u7ed3\u675f\u503c\u548c\u6b65\u957f\u3002\u4f8b\u5982\uff0c\u8981\u751f\u6210\u4ece1\u523010\u7684\u5947\u6570\u5217\u8868\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">odd_list = list(range(1, 11, 2))<\/p>\n<p>print(odd_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 3, 5, 7, 9]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u521b\u5efa\u5217\u8868<\/h2>\n<\/p>\n<p><p>\u5217\u8868\u63a8\u5bfc\u5f0f\u662f\u4e00\u79cd\u7b80\u6d01\u7684\u521b\u5efa\u5217\u8868\u7684\u65b9\u5f0f\uff0c\u5b83\u5141\u8bb8\u4f60\u5728\u4e00\u884c\u4ee3\u7801\u4e2d\u5b9a\u4e49\u5217\u8868\u7684\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u7b80\u5355\u7684\u5217\u8868\u63a8\u5bfc\u5f0f<\/h3>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u8981\u521b\u5efa\u4e00\u4e2a\u5305\u542b1\u523010\u7684\u5e73\u65b9\u7684\u5217\u8868\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">squares = [x2 for x in range(1, 11)]<\/p>\n<p>print(squares)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5e26\u6709\u6761\u4ef6\u7684\u5217\u8868\u63a8\u5bfc\u5f0f<\/h3>\n<\/p>\n<p><p>\u8fd8\u53ef\u4ee5\u5728\u5217\u8868\u63a8\u5bfc\u5f0f\u4e2d\u6dfb\u52a0\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u8981\u521b\u5efa\u4e00\u4e2a\u5305\u542b1\u523010\u4e2d\u6240\u6709\u5076\u6570\u7684\u5e73\u65b9\u7684\u5217\u8868\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">even_squares = [x2 for x in range(1, 11) if x % 2 == 0]<\/p>\n<p>print(even_squares)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[4, 16, 36, 64, 100]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u4ece\u7528\u6237\u8f93\u5165\u521b\u5efa\u5217\u8868<\/h2>\n<\/p>\n<p><p>\u6709\u65f6\u9700\u8981\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u52a8\u6001\u5730\u521b\u5efa\u5217\u8868\u3002\u53ef\u4ee5\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u548c<code>split()<\/code>\u65b9\u6cd5\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u4ece\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u521b\u5efa\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u5047\u8bbe\u7528\u6237\u8f93\u5165\u4e00\u884c\u6570\u5b57\uff0c\u5e76\u5e0c\u671b\u5c06\u5176\u8f6c\u6362\u4e3a\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_input = input(&quot;Enter numbers separated by spaces: &quot;)<\/p>\n<p>user_list = user_input.split()<\/p>\n<p>print(user_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u7528\u6237\u8f93\u5165 <code>1 2 3 4 5<\/code>\uff0c\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[&#39;1&#39;, &#39;2&#39;, &#39;3&#39;, &#39;4&#39;, &#39;5&#39;]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5c06\u7528\u6237\u8f93\u5165\u8f6c\u6362\u4e3a\u6574\u6570\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u5c06\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6574\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_input = input(&quot;Enter numbers separated by spaces: &quot;)<\/p>\n<p>user_list = [int(x) for x in user_input.split()]<\/p>\n<p>print(user_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u7528\u6237\u8f93\u5165 <code>1 2 3 4 5<\/code>\uff0c\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528<code>append()<\/code>\u65b9\u6cd5\u52a8\u6001\u6dfb\u52a0\u5143\u7d20\u5230\u5217\u8868<\/h2>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>append()<\/code>\u65b9\u6cd5\u5c06\u5143\u7d20\u52a8\u6001\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u5408\u5728\u5faa\u73af\u4e2d\u9010\u6b65\u6784\u5efa\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u7b80\u5355\u7684<code>append()<\/code>\u793a\u4f8b<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = []<\/p>\n<p>for i in range(5):<\/p>\n<p>    my_list.append(i)<\/p>\n<p>print(my_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[0, 1, 2, 3, 4]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u4ece\u7528\u6237\u8f93\u5165\u52a8\u6001\u6dfb\u52a0\u5143\u7d20<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u9010\u6b65\u8bfb\u53d6\u7528\u6237\u7684\u8f93\u5165\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_list = []<\/p>\n<p>while True:<\/p>\n<p>    user_input = input(&quot;Enter a number (or &#39;done&#39; to finish): &quot;)<\/p>\n<p>    if user_input.lower() == &#39;done&#39;:<\/p>\n<p>        break<\/p>\n<p>    user_list.append(int(user_input))<\/p>\n<p>print(user_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u6839\u636e\u7528\u6237\u8f93\u5165\u52a8\u6001\u6784\u5efa\u4e00\u4e2a\u6574\u6570\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h2>\u4e03\u3001\u4f7f\u7528\u5217\u8868\u7684\u590d\u5236\u548c\u6269\u5c55\u65b9\u6cd5<\/h2>\n<\/p>\n<p><p>\u6709\u65f6\u9700\u8981\u4ece\u73b0\u6709\u7684\u5217\u8868\u521b\u5efa\u65b0\u7684\u5217\u8868\uff0c\u6216\u8005\u5c06\u4e24\u4e2a\u5217\u8868\u5408\u5e76\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u590d\u5236\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>copy()<\/code>\u65b9\u6cd5\u6216\u8005\u5207\u7247\u6765\u590d\u5236\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">original_list = [1, 2, 3, 4, 5]<\/p>\n<p>copied_list = original_list.copy()<\/p>\n<p>print(copied_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5408\u5e76\u5217\u8868<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>extend()<\/code>\u65b9\u6cd5\u6216\u8005\u52a0\u53f7\u8fd0\u7b97\u7b26\u6765\u5408\u5e76\u4e24\u4e2a\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">list1 = [1, 2, 3]<\/p>\n<p>list2 = [4, 5, 6]<\/p>\n<p>list1.extend(list2)<\/p>\n<p>print(list1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5, 6]<\/code>\u3002<\/p>\n<\/p>\n<p><p>\u6216\u8005\u4f7f\u7528\u52a0\u53f7\u8fd0\u7b97\u7b26\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">list1 = [1, 2, 3]<\/p>\n<p>list2 = [4, 5, 6]<\/p>\n<p>merged_list = list1 + list2<\/p>\n<p>print(merged_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 2, 3, 4, 5, 6]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u516b\u3001\u4f7f\u7528\u5d4c\u5957\u5217\u8868<\/h2>\n<\/p>\n<p><p>\u5d4c\u5957\u5217\u8868\u662f\u6307\u5217\u8868\u4e2d\u7684\u5143\u7d20\u672c\u8eab\u4e5f\u662f\u5217\u8868\u3002\u8fd9\u79cd\u7ed3\u6784\u5728\u5904\u7406\u591a\u7ef4\u6570\u636e\u65f6\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u5d4c\u5957\u5217\u8868<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]<\/p>\n<p>print(nested_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[[1, 2, 3], [4, 5, 6], [7, 8, 9]]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u8bbf\u95ee\u5d4c\u5957\u5217\u8868\u4e2d\u7684\u5143\u7d20<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u591a\u91cd\u7d22\u5f15\u8bbf\u95ee\u5d4c\u5957\u5217\u8868\u4e2d\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]<\/p>\n<p>print(nested_list[0][1])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>2<\/code>\uff0c\u5b83\u662f\u7b2c\u4e00\u4e2a\u5b50\u5217\u8868\u4e2d\u7684\u7b2c\u4e8c\u4e2a\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><h2>\u4e5d\u3001\u5217\u8868\u7684\u5e38\u7528\u64cd\u4f5c\u548c\u65b9\u6cd5<\/h2>\n<\/p>\n<p><p>Python\u5217\u8868\u63d0\u4f9b\u4e86\u8bb8\u591a\u5e38\u7528\u7684\u64cd\u4f5c\u548c\u65b9\u6cd5\uff0c\u4f7f\u5f97\u5217\u8868\u7684\u5904\u7406\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u83b7\u53d6\u5217\u8868\u957f\u5ea6<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u83b7\u53d6\u5217\u8868\u7684\u957f\u5ea6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(len(my_list))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>5<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u68c0\u67e5\u5143\u7d20\u662f\u5426\u5728\u5217\u8868\u4e2d<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>in<\/code>\u8fd0\u7b97\u7b26\u68c0\u67e5\u5143\u7d20\u662f\u5426\u5728\u5217\u8868\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(3 in my_list)<\/p>\n<p>print(6 in my_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>True<\/code> \u548c <code>False<\/code>\u3002<\/p>\n<\/p>\n<p><h3>3\u3001\u5217\u8868\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>sort()<\/code>\u65b9\u6cd5\u5bf9\u5217\u8868\u8fdb\u884c\u6392\u5e8f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [3, 1, 4, 1, 5, 9, 2]<\/p>\n<p>my_list.sort()<\/p>\n<p>print(my_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 1, 2, 3, 4, 5, 9]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>4\u3001\u5217\u8868\u53cd\u8f6c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>reverse()<\/code>\u65b9\u6cd5\u53cd\u8f6c\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>my_list.reverse()<\/p>\n<p>print(my_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[5, 4, 3, 2, 1]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>5\u3001\u67e5\u627e\u5143\u7d20\u7684\u7d22\u5f15<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>index()<\/code>\u65b9\u6cd5\u67e5\u627e\u5143\u7d20\u7684\u7d22\u5f15\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(my_list.index(3))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>2<\/code>\uff0c\u5b83\u662f\u5143\u7d20 <code>3<\/code> \u7684\u7d22\u5f15\u3002<\/p>\n<\/p>\n<p><h2>\u5341\u3001\u5217\u8868\u7684\u5207\u7247\u64cd\u4f5c<\/h2>\n<\/p>\n<p><p>Python\u5217\u8868\u652f\u6301\u5207\u7247\u64cd\u4f5c\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6\u5b50\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u7b80\u5355\u7684\u5207\u7247\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u5207\u7247\u64cd\u4f5c\u7b26 <code>:<\/code> \u83b7\u53d6\u5b50\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(my_list[1:4])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[2, 3, 4]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5e26\u6709\u6b65\u957f\u7684\u5207\u7247\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u8fd8\u53ef\u4ee5\u6307\u5b9a\u6b65\u957f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/p>\n<p>print(my_list[::2])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[1, 3, 5, 7, 9]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>3\u3001\u53cd\u5411\u5207\u7247\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u8d1f\u6570\u6b65\u957f\u53cd\u5411\u5207\u7247\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [1, 2, 3, 4, 5]<\/p>\n<p>print(my_list[::-1])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[5, 4, 3, 2, 1]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u5341\u4e00\u3001\u5217\u8868\u7684\u9ad8\u7ea7\u7528\u6cd5<\/h2>\n<\/p>\n<p><p>\u9664\u4e86\u4e0a\u8ff0\u57fa\u672c\u64cd\u4f5c\u5916\uff0cPython\u5217\u8868\u8fd8\u6709\u4e00\u4e9b\u9ad8\u7ea7\u7528\u6cd5\uff0c\u4f7f\u5f97\u5b83\u5728\u590d\u6742\u573a\u666f\u4e2d\u4e5f\u80fd\u5f97\u5fc3\u5e94\u624b\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u5217\u8868\u7684\u5185\u5b58\u5171\u4eab\u4e0e\u6df1\u62f7\u8d1d<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5217\u8868\u7684\u8d4b\u503c\u64cd\u4f5c\u5e76\u4e0d\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5217\u8868\u5bf9\u8c61\uff0c\u800c\u662f\u521b\u5efa\u4e00\u4e2a\u5bf9\u539f\u5217\u8868\u7684\u5f15\u7528\u3002\u8fd9\u610f\u5473\u7740\u4fee\u6539\u65b0\u5217\u8868\u4f1a\u5f71\u54cd\u539f\u5217\u8868\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u4f7f\u7528<code>copy<\/code>\u6a21\u5757\u4e2d\u7684<code>deepcopy<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import copy<\/p>\n<p>original_list = [1, 2, [3, 4]]<\/p>\n<p>shallow_copy = original_list.copy()<\/p>\n<p>deep_copy = copy.deepcopy(original_list)<\/p>\n<p>shallow_copy[2][0] = 99<\/p>\n<p>print(original_list)  # \u8f93\u51fa: [1, 2, [99, 4]]<\/p>\n<p>print(shallow_copy)   # \u8f93\u51fa: [1, 2, [99, 4]]<\/p>\n<p>print(deep_copy)      # \u8f93\u51fa: [1, 2, [3, 4]]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u5217\u8868\u7684\u5d4c\u5957\u4e0e\u591a\u7ef4\u6570\u7ec4<\/h3>\n<\/p>\n<p><p>\u5217\u8868\u7684\u5d4c\u5957\u4f7f\u5f97\u5b83\u53ef\u4ee5\u7528\u4f5c\u591a\u7ef4\u6570\u7ec4\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u4e8c\u7ef4\u5217\u8868\u6765\u8868\u793a\u77e9\u9635\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">matrix = [<\/p>\n<p>    [1, 2, 3],<\/p>\n<p>    [4, 5, 6],<\/p>\n<p>    [7, 8, 9]<\/p>\n<p>]<\/p>\n<h2><strong>\u8bbf\u95ee\u5143\u7d20<\/strong><\/h2>\n<p>print(matrix[1][2])  # \u8f93\u51fa: 6<\/p>\n<h2><strong>\u4fee\u6539\u5143\u7d20<\/strong><\/h2>\n<p>matrix[1][2] = 99<\/p>\n<p>print(matrix[1][2])  # \u8f93\u51fa: 99<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u5217\u8868\u63a8\u5bfc\u5f0f\u7684\u9ad8\u7ea7\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>\u5217\u8868\u63a8\u5bfc\u5f0f\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u7b80\u5355\u7684\u5217\u8868\u751f\u6210\uff0c\u8fd8\u53ef\u4ee5\u5d4c\u5957\u548c\u4f7f\u7528\u590d\u6742\u7684\u6761\u4ef6\u8868\u8fbe\u5f0f\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u591a\u5c42\u5d4c\u5957\u5217\u8868\u63a8\u5bfc\u5f0f<\/h4>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u8981\u751f\u6210\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\u7684\u8f6c\u7f6e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5d4c\u5957\u7684\u5217\u8868\u63a8\u5bfc\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">matrix = [<\/p>\n<p>    [1, 2, 3],<\/p>\n<p>    [4, 5, 6],<\/p>\n<p>    [7, 8, 9]<\/p>\n<p>]<\/p>\n<p>transpose = [[row[i] for row in matrix] for i in range(len(matrix[0]))]<\/p>\n<p>print(transpose)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[[1, 4, 7], [2, 5, 8], [3, 6, 9]]<\/code>\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u5e26\u6709\u590d\u6742\u6761\u4ef6\u7684\u5217\u8868\u63a8\u5bfc\u5f0f<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5728\u5217\u8868\u63a8\u5bfc\u5f0f\u4e2d\u4f7f\u7528\u590d\u6742\u7684\u6761\u4ef6\u8868\u8fbe\u5f0f\u3002\u4f8b\u5982\uff0c\u8981\u751f\u6210\u4e00\u4e2a\u5305\u542b1\u5230100\u4e2d\u6240\u6709\u65e2\u662f3\u7684\u500d\u6570\u53c8\u662f5\u7684\u500d\u6570\u7684\u6570\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">result = [x for x in range(1, 101) if x % 3 == 0 and x % 5 == 0]<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4ee3\u7801\u6bb5\u5c06\u8f93\u51fa <code>[15, 30, 45, 60, 75, 90]<\/code>\u3002<\/p>\n<\/p>\n<p><h2>\u5341\u4e8c\u3001\u5217\u8868\u7684\u6027\u80fd\u4f18\u5316<\/h2>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u6570\u636e\u65f6\uff0c\u5217\u8868\u7684\u6027\u80fd\u4f18\u5316\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u8003\u8651\u56e0\u7d20\u3002Python\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5de5\u5177\u548c\u6280\u672f\u6765\u63d0\u9ad8\u5217\u8868\u64cd\u4f5c\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f<\/h3>\n<\/p>\n<p><p>\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u4e0e\u5217\u8868\u63a8\u5bfc\u5f0f\u7c7b\u4f3c\uff0c\u4f46\u5b83\u4e0d\u4f1a\u4e00\u6b21\u6027\u751f\u6210\u6574\u4e2a\u5217\u8868\uff0c\u800c\u662f\u6309\u9700\u751f\u6210\u5143\u7d20\uff0c\u4ece\u800c\u8282\u7701\u5185\u5b58\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">gen = (x2 for x in range(1000000))<\/p>\n<p>print(next(gen))<\/p>\n<p>print(next(gen))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u4f7f\u7528<code>array<\/code>\u6a21\u5757<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u6570\u503c\u5217\u8868\uff0c\u53ef\u4ee5\u4f7f\u7528<code>array<\/code>\u6a21\u5757\uff0c\u5b83\u6bd4\u666e\u901a\u7684Python\u5217\u8868\u66f4\u9ad8\u6548\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import array<\/p>\n<p>arr = array.array(&#39;i&#39;, [1, 2, 3, 4, 5])<\/p>\n<p>print(arr)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u4f7f\u7528<code>numpy<\/code>\u5e93<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u66f4\u9ad8\u7ea7\u7684\u6570\u503c\u8ba1\u7b97\uff0c\u53ef\u4ee5\u4f7f\u7528<code>numpy<\/code>\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>arr = np.array([1, 2, 3, 4, 5])<\/p>\n<p>print(arr)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u7ed3\u8bba<\/h2>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u521b\u5efa\u548c\u64cd\u4f5c\u5217\u8868\uff0c\u4ece\u7b80\u5355\u7684\u65b9\u62ec\u53f7\u8868\u793a\u6cd5\u5230\u590d\u6742\u7684\u5217\u8868\u63a8\u5bfc\u5f0f\uff0c\u518d\u5230\u9ad8\u6548\u7684\u6570\u503c\u8ba1\u7b97\u5e93\u3002\u901a\u8fc7\u4e86\u89e3\u548c\u638c\u63e1\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u5e94\u7528\u573a\u666f\u4e2d\u7075\u6d3b\u5730\u4f7f\u7528\u5217\u8868\uff0c\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u8fd0\u884c\u6548\u7387\u3002\u65e0\u8bba\u662f\u5904\u7406\u7b80\u5355\u7684\u6570\u636e\u96c6\u5408\uff0c\u8fd8\u662f\u9700\u8981\u8fdb\u884c\u590d\u6742\u7684\u591a\u7ef4\u6570\u7ec4\u8fd0\u7b97\uff0cPython\u7684\u5217\u8868\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5feb\u901f\u521b\u5efa\u4e00\u4e2a\u5217\u8868\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u65b9\u62ec\u53f7<code>[]<\/code>\u76f4\u63a5\u521b\u5efa\u4e00\u4e2a\u5217\u8868\uff0c\u4f8b\u5982\uff1a<code>my_list = [1, 2, 3, 4, 5]<\/code>\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>list()<\/code>\u51fd\u6570\u5c06\u5176\u4ed6\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff08\u5982\u5b57\u7b26\u4e32\u3001\u5143\u7ec4\u7b49\uff09\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u6bd4\u5982<code>my_list = list((1, 2, 3))<\/code>\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u4ece\u7528\u6237\u8f93\u5165\u751f\u6210\u4e00\u4e2a\u5217\u8868\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u83b7\u53d6\u7528\u6237\u8f93\u5165\uff0c\u5e76\u901a\u8fc7<code>split()<\/code>\u65b9\u6cd5\u5c06\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5206\u5272\u6210\u591a\u4e2a\u5143\u7d20\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>&quot;1 2 3 4 5&quot;<\/code>\u540e\uff0c\u53ef\u4ee5\u8fd9\u6837\u5904\u7406\uff1a<code>user_input = input(&quot;\u8bf7\u8f93\u5165\u6570\u5b57\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff1a&quot;)<\/code>\uff0c\u7136\u540e\u4f7f\u7528<code>my_list = user_input.split()<\/code>\u5c06\u5176\u8f6c\u6362\u4e3a\u5217\u8868\u3002\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6574\u6570\uff1a<code>my_list = [int(i) for i in user_input.split()]<\/code>\u3002<\/p>\n<p><strong>Python\u7684\u5217\u8868\u53ef\u4ee5\u5305\u542b\u54ea\u4e9b\u7c7b\u578b\u7684\u6570\u636e\uff1f<\/strong><br \/>Python\u7684\u5217\u8868\u662f\u975e\u5e38\u7075\u6d3b\u7684\uff0c\u53ef\u4ee5\u5305\u542b\u4e0d\u540c\u7c7b\u578b\u7684\u6570\u636e\uff0c\u5305\u62ec\u6570\u5b57\u3001\u5b57\u7b26\u4e32\u3001\u5e03\u5c14\u503c\u3001\u751a\u81f3\u5176\u4ed6\u5217\u8868\u3002\u4e3e\u4f8b\u6765\u8bf4\uff0c<code>mixed_list = [1, &quot;hello&quot;, 3.14, True, [2, 4, 6]]<\/code>\u4fbf\u662f\u4e00\u4e2a\u5305\u542b\u591a\u79cd\u7c7b\u578b\u5143\u7d20\u7684\u5217\u8868\u3002\u8fd9\u79cd\u7279\u6027\u4f7f\u5f97Python\u5217\u8868\u5728\u5904\u7406\u591a\u79cd\u6570\u636e\u65f6\u6781\u4e3a\u65b9\u4fbf\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e2d\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u76f4\u63a5\u8f93\u5165\u5217\u8868\u3001\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u65b9\u62ec\u53f7\u3001\u8fd8\u53ef\u4ee5\u901a\u8fc7list()\u51fd\u6570\u548crange( [&hellip;]","protected":false},"author":3,"featured_media":1170607,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170602"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1170602"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170602\/revisions"}],"predecessor-version":[{"id":1170610,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1170602\/revisions\/1170610"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1170607"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1170602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1170602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1170602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}