{"id":1020486,"date":"2024-12-27T13:12:29","date_gmt":"2024-12-27T05:12:29","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1020486.html"},"modified":"2024-12-27T13:12:31","modified_gmt":"2024-12-27T05:12:31","slug":"python%e5%a6%82%e4%bd%95%e5%af%b9%e5%ad%97%e5%85%b8%e8%b5%8b%e5%80%bc","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1020486.html","title":{"rendered":"python\u5982\u4f55\u5bf9\u5b57\u5178\u8d4b\u503c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25162844\/048c2dfa-70c4-49b6-94f2-276e93fad78b.webp\" alt=\"python\u5982\u4f55\u5bf9\u5b57\u5178\u8d4b\u503c\" \/><\/p>\n<p><p> \u5728Python\u4e2d\u5bf9\u5b57\u5178\u8d4b\u503c\u53ef\u4ee5\u901a\u8fc7<strong>\u76f4\u63a5\u5728\u5b57\u5178\u4e2d\u6307\u5b9a\u952e\u503c\u5bf9<\/strong>\u3001<strong>\u4f7f\u7528<code>update()<\/code>\u65b9\u6cd5\u66f4\u65b0\u5b57\u5178<\/strong>\u3001<strong>\u5229\u7528<code>setdefault()<\/code>\u65b9\u6cd5\u8bbe\u7f6e\u9ed8\u8ba4\u503c<\/strong>\u3001<strong>\u901a\u8fc7\u5b57\u5178\u63a8\u5bfc\u5f0f<\/strong>\u7b49\u65b9\u5f0f\u6765\u5b9e\u73b0\u3002<strong>\u76f4\u63a5\u6307\u5b9a\u952e\u503c\u5bf9\u662f\u6700\u5e38\u7528\u4e5f\u662f\u6700\u7b80\u5355\u7684\u65b9\u6cd5<\/strong>\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b57\u5178\u7684\u952e\u6765\u8bbf\u95ee\u5e76\u4fee\u6539\u5bf9\u5e94\u7684\u503c\u3002\u5982\u679c\u952e\u4e0d\u5b58\u5728\uff0cPython\u4f1a\u81ea\u52a8\u5728\u5b57\u5178\u4e2d\u6dfb\u52a0\u8be5\u952e\u503c\u5bf9\u3002\u4ee5\u4e0b\u662f\u5173\u4e8e\u8fd9\u4e9b\u65b9\u6cd5\u7684\u8be6\u7ec6\u89e3\u91ca\u548c\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u76f4\u63a5\u5728\u5b57\u5178\u4e2d\u6307\u5b9a\u952e\u503c\u5bf9<\/h3>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u5f0f\u662f\u6700\u76f4\u63a5\u7684\u5b57\u5178\u8d4b\u503c\u65b9\u6cd5\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5bf9\u5b57\u5178\u4e2d\u7684\u67d0\u4e2a\u952e\u8d4b\u503c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8d4b\u503c\u64cd\u4f5c\u81ea\u52a8\u6dfb\u52a0\u65b0\u7684\u952e\u503c\u5bf9\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521b\u5efa\u4e00\u4e2a\u5b57\u5178<\/p>\n<p>my_dict = {&#39;apple&#39;: 2, &#39;banana&#39;: 3}<\/p>\n<h2><strong>\u5bf9\u73b0\u6709\u952e\u8d4b\u503c<\/strong><\/h2>\n<p>my_dict[&#39;apple&#39;] = 5<\/p>\n<h2><strong>\u6dfb\u52a0\u65b0\u952e\u503c\u5bf9<\/strong><\/h2>\n<p>my_dict[&#39;cherry&#39;] = 10<\/p>\n<p>print(my_dict)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u5b57\u5178<code>my_dict<\/code>\u4e2d<code>&#39;apple&#39;<\/code>\u7684\u503c\u88ab\u66f4\u65b0\u4e3a<code>5<\/code>\uff0c\u5e76\u4e14\u65b0\u589e\u4e86\u952e<code>&#39;cherry&#39;<\/code>\uff0c\u5176\u503c\u4e3a<code>10<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528<code>update()<\/code>\u65b9\u6cd5\u66f4\u65b0\u5b57\u5178<\/h3>\n<\/p>\n<p><p><code>update()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u7528\u4e8e\u540c\u65f6\u66f4\u65b0\u591a\u4e2a\u952e\u503c\u5bf9\u3002\u53ef\u4ee5\u4f20\u5165\u53e6\u4e00\u4e2a\u5b57\u5178\u6216\u53ef\u8fed\u4ee3\u7684\u952e\u503c\u5bf9\u6765\u66f4\u65b0\u76ee\u6807\u5b57\u5178\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521d\u59cb\u5b57\u5178<\/p>\n<p>my_dict = {&#39;apple&#39;: 2, &#39;banana&#39;: 3}<\/p>\n<h2><strong>\u4f7f\u7528\u53e6\u4e00\u4e2a\u5b57\u5178\u66f4\u65b0<\/strong><\/h2>\n<p>my_dict.update({&#39;banana&#39;: 4, &#39;cherry&#39;: 10})<\/p>\n<h2><strong>\u4f7f\u7528\u952e\u503c\u5bf9\u66f4\u65b0<\/strong><\/h2>\n<p>my_dict.update(orange=5, mango=7)<\/p>\n<p>print(my_dict)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5b57\u5178<code>my_dict<\/code>\u88ab<code>update()<\/code>\u65b9\u6cd5\u66f4\u65b0\uff0c<code>&#39;banana&#39;<\/code>\u7684\u503c\u53d8\u4e3a<code>4<\/code>\uff0c\u5e76\u65b0\u589e\u4e86<code>&#39;cherry&#39;<\/code>\u3001<code>&#39;orange&#39;<\/code>\u548c<code>&#39;mango&#39;<\/code>\u7684\u952e\u503c\u5bf9\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5229\u7528<code>setdefault()<\/code>\u65b9\u6cd5\u8bbe\u7f6e\u9ed8\u8ba4\u503c<\/h3>\n<\/p>\n<p><p><code>setdefault()<\/code>\u65b9\u6cd5\u7528\u4e8e\u5728\u5b57\u5178\u4e2d\u67e5\u627e\u952e\uff0c\u5982\u679c\u952e\u5b58\u5728\u5219\u8fd4\u56de\u5bf9\u5e94\u503c\uff1b\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u5219\u6dfb\u52a0\u8be5\u952e\u5e76\u8bbe\u7f6e\u5176\u9ed8\u8ba4\u503c\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521d\u59cb\u5b57\u5178<\/p>\n<p>my_dict = {&#39;apple&#39;: 2, &#39;banana&#39;: 3}<\/p>\n<h2><strong>\u8bbe\u7f6e\u9ed8\u8ba4\u503c<\/strong><\/h2>\n<p>value = my_dict.setdefault(&#39;banana&#39;, 5)<\/p>\n<p>print(value)  # \u8f93\u51fa: 3<\/p>\n<p>value = my_dict.setdefault(&#39;cherry&#39;, 10)<\/p>\n<p>print(value)  # \u8f93\u51fa: 10<\/p>\n<p>print(my_dict)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c<code>setdefault()<\/code>\u65b9\u6cd5\u5bf9\u5df2\u5b58\u5728\u7684<code>&#39;banana&#39;<\/code>\u8fd4\u56de\u5176\u503c<code>3<\/code>\uff0c\u5e76\u4e3a\u4e0d\u5b58\u5728\u7684\u952e<code>&#39;cherry&#39;<\/code>\u8bbe\u7f6e\u9ed8\u8ba4\u503c<code>10<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u901a\u8fc7\u5b57\u5178\u63a8\u5bfc\u5f0f<\/h3>\n<\/p>\n<p><p>\u5b57\u5178\u63a8\u5bfc\u5f0f\u662f\u4e00\u79cd\u521b\u5efa\u5b57\u5178\u7684\u65b0\u65b9\u5f0f\uff0c\u80fd\u591f\u4ee5\u7b80\u6d01\u7684\u8bed\u6cd5\u751f\u6210\u5b57\u5178\u5e76\u8d4b\u503c\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4f7f\u7528\u5b57\u5178\u63a8\u5bfc\u5f0f\u521b\u5efa\u5b57\u5178<\/p>\n<p>squared_dict = {x: x2 for x in range(1, 6)}<\/p>\n<p>print(squared_dict)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7\u5b57\u5178\u63a8\u5bfc\u5f0f\u521b\u5efa\u4e00\u4e2a\u5b57\u5178\uff0c\u5176\u4e2d\u952e\u662f\u4ece<code>1<\/code>\u5230<code>5<\/code>\u7684\u6570\u5b57\uff0c\u800c\u503c\u662f\u8fd9\u4e9b\u6570\u5b57\u7684\u5e73\u65b9\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b57\u5178\u8d4b\u503c\u7684\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<ol>\n<li><strong>\u952e\u7684\u552f\u4e00\u6027<\/strong>\uff1a\u5b57\u5178\u4e2d\u7684\u952e\u5fc5\u987b\u662f\u552f\u4e00\u7684\u3002\u5982\u679c\u5bf9\u540c\u4e00\u4e2a\u952e\u8d4b\u503c\uff0c\u4f1a\u8986\u76d6\u6389\u4e4b\u524d\u7684\u503c\u3002<\/li>\n<li><strong>\u952e\u7684\u7c7b\u578b<\/strong>\uff1a\u5b57\u5178\u7684\u952e\u5fc5\u987b\u662f\u4e0d\u53ef\u53d8\u7684\u6570\u636e\u7c7b\u578b\uff0c\u4f8b\u5982\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u6216\u5143\u7ec4\u3002<\/li>\n<li><strong>\u5b57\u5178\u662f\u65e0\u5e8f\u7684<\/strong>\uff1a\u5728Python 3.7\u53ca\u4e4b\u540e\uff0c\u5b57\u5178\u4fdd\u6301\u63d2\u5165\u987a\u5e8f\uff0c\u4f46\u5728\u66f4\u65e9\u7684\u7248\u672c\u4e2d\uff0c\u5b57\u5178\u662f\u65e0\u5e8f\u7684\u3002<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u5b57\u5178\u8d4b\u503c\u7684\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<ol>\n<li><strong>\u7edf\u8ba1\u8ba1\u6570<\/strong>\uff1a\u5b57\u5178\u5e38\u7528\u4e8e\u7edf\u8ba1\u5bf9\u8c61\u7684\u51fa\u73b0\u6b21\u6570\u3002<\/li>\n<li><strong>\u6570\u636e\u6620\u5c04<\/strong>\uff1a\u5c06\u4e00\u4e2a\u6570\u636e\u96c6\u4e2d\u7684\u503c\u6620\u5c04\u5230\u53e6\u4e00\u4e2a\u503c\u3002<\/li>\n<li><strong>\u914d\u7f6e\u7ba1\u7406<\/strong>\uff1a\u4f7f\u7528\u5b57\u5178\u5b58\u50a8\u548c\u66f4\u65b0\u914d\u7f6e\u4fe1\u606f\u3002<\/li>\n<\/ol>\n<p><h4>\u793a\u4f8b\uff1a\u7edf\u8ba1\u5b57\u7b26\u51fa\u73b0\u6b21\u6570<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;hello world&quot;<\/p>\n<p>char_count = {}<\/p>\n<p>for char in text:<\/p>\n<p>    if char in char_count:<\/p>\n<p>        char_count[char] += 1<\/p>\n<p>    else:<\/p>\n<p>        char_count[char] = 1<\/p>\n<p>print(char_count)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b57\u5178<code>char_count<\/code>\u7528\u4e8e\u7edf\u8ba1\u5b57\u7b26\u4e32<code>text<\/code>\u4e2d\u6bcf\u4e2a\u5b57\u7b26\u7684\u51fa\u73b0\u6b21\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u5b57\u5178\u8d4b\u503c\u7684\u6027\u80fd\u8003\u8651<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u5927\u91cf\u5b57\u5178\u8d4b\u503c\u64cd\u4f5c\u65f6\uff0c\u6548\u7387\u662f\u4e00\u4e2a\u9700\u8981\u8003\u8651\u7684\u95ee\u9898\u3002Python\u7684\u5b57\u5178\u5728\u5904\u7406\u952e\u503c\u5bf9\u64cd\u4f5c\u65f6\u5177\u6709\u8f83\u9ad8\u7684\u6548\u7387\uff0c\u56e0\u4e3a\u5176\u5e95\u5c42\u662f\u57fa\u4e8e\u54c8\u5e0c\u8868\u5b9e\u73b0\u7684\u3002\u7136\u800c\uff0c\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f8b\u5982\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\u6216\u9700\u8981\u9891\u7e41\u66f4\u65b0\u7684\u573a\u666f\u4e0b\uff0c\u9700\u8981\u8003\u8651\u4f18\u5316\u7b56\u7565\uff0c\u6bd4\u5982\u4f7f\u7528<code>collections.defaultdict<\/code>\u6765\u7b80\u5316\u8ba1\u6570\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a\u4f7f\u7528<code>defaultdict<\/code>\u4f18\u5316\u8ba1\u6570<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">from collections import defaultdict<\/p>\n<p>text = &quot;hello world&quot;<\/p>\n<p>char_count = defaultdict(int)<\/p>\n<p>for char in text:<\/p>\n<p>    char_count[char] += 1<\/p>\n<p>print(char_count)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>defaultdict<\/code>\u7b80\u5316\u4e86\u5b57\u7b26\u8ba1\u6570\u7684\u903b\u8f91\uff0c\u4f7f\u5f97\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u548c\u9ad8\u6548\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u5b57\u5178\u5408\u5e76\u4e0e\u66f4\u65b0\u7684\u65b0\u7279\u6027<\/h3>\n<\/p>\n<p><p>\u5728Python 3.9\u4e2d\uff0c\u5f15\u5165\u4e86\u5b57\u5178\u5408\u5e76\u4e0e\u66f4\u65b0\u7684\u65b0\u8bed\u6cd5\uff0c\u53ef\u4ee5\u4f7f\u7528<code>|<\/code>\u64cd\u4f5c\u7b26\u8fdb\u884c\u5b57\u5178\u5408\u5e76\uff0c\u7528<code>|=<\/code>\u8fdb\u884c\u5b57\u5178\u66f4\u65b0\uff0c\u8fd9\u4f7f\u5f97\u5b57\u5178\u64cd\u4f5c\u66f4\u52a0\u76f4\u89c2\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a\u5b57\u5178\u5408\u5e76\u4e0e\u66f4\u65b0<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u521d\u59cb\u5b57\u5178<\/p>\n<p>dict_a = {&#39;apple&#39;: 2, &#39;banana&#39;: 3}<\/p>\n<p>dict_b = {&#39;banana&#39;: 4, &#39;cherry&#39;: 10}<\/p>\n<h2><strong>\u5b57\u5178\u5408\u5e76<\/strong><\/h2>\n<p>merged_dict = dict_a | dict_b<\/p>\n<p>print(merged_dict)<\/p>\n<h2><strong>\u5b57\u5178\u66f4\u65b0<\/strong><\/h2>\n<p>dict_a |= dict_b<\/p>\n<p>print(dict_a)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>|<\/code>\u64cd\u4f5c\u7b26\u7528\u4e8e\u5408\u5e76\u4e24\u4e2a\u5b57\u5178\uff0c\u5176\u4e2d\u540e\u9762\u7684\u5b57\u5178\u4e2d\u7684\u503c\u4f1a\u8986\u76d6\u524d\u9762\u5b57\u5178\u4e2d\u7684\u503c\u3002<\/p>\n<\/p>\n<p><h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u4e2d\u7684\u5b57\u5178\u8d4b\u503c\u64cd\u4f5c\u63d0\u4f9b\u4e86\u7075\u6d3b\u591a\u6837\u7684\u65b9\u5f0f\u6765\u5904\u7406\u952e\u503c\u5bf9\uff0c\u6ee1\u8db3\u4e86\u4e0d\u540c\u573a\u666f\u7684\u9700\u6c42\u3002<strong>\u65e0\u8bba\u662f\u901a\u8fc7\u76f4\u63a5\u8d4b\u503c\u3001\u4f7f\u7528<code>update()<\/code>\u65b9\u6cd5\u3001<code>setdefault()<\/code>\u3001\u5b57\u5178\u63a8\u5bfc\u5f0f\uff0c\u8fd8\u662f\u5229\u7528<code>defaultdict<\/code>\u8fdb\u884c\u4f18\u5316\uff0c\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u52bf<\/strong>\u3002\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\uff0c\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u9ad8\u6548\u5730\u5904\u7406\u6570\u636e\uff0c\u8fdb\u884c\u590d\u6742\u7684\u6570\u636e\u64cd\u4f5c\u548c\u7ba1\u7406\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u5178\u5e76\u8d4b\u503c\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5927\u62ec\u53f7 <code>{}<\/code> \u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u5178\uff0c\u5e76\u76f4\u63a5\u5728\u5176\u5185\u90e8\u6307\u5b9a\u952e\u503c\u5bf9\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">my_dict = {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 30}\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u521b\u5efa\u4e86\u4e00\u4e2a\u5305\u542b\u4e24\u4e2a\u952e\uff08<code>name<\/code> \u548c <code>age<\/code>\uff09\u53ca\u5176\u5bf9\u5e94\u503c\u7684\u5b57\u5178\u3002<\/p>\n<p><strong>\u5982\u4f55\u66f4\u65b0\u5b57\u5178\u4e2d\u7684\u5df2\u6709\u952e\u7684\u503c\uff1f<\/strong><br \/>\u8981\u66f4\u65b0\u5b57\u5178\u4e2d\u67d0\u4e2a\u952e\u7684\u503c\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u952e\u6765\u8bbf\u95ee\u5e76\u8d4b\u503c\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">my_dict[&#39;age&#39;] = 31\n<\/code><\/pre>\n<p>\u8fd9\u6761\u8bed\u53e5\u5c06 <code>my_dict<\/code> \u4e2d <code>age<\/code> \u952e\u7684\u503c\u4ece 30 \u66f4\u65b0\u4e3a 31\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u5b57\u5178\u4e2d\u6dfb\u52a0\u65b0\u7684\u952e\u503c\u5bf9\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u4e00\u4e2a\u65b0\u952e\u5e76\u8d4b\u503c\u6765\u6dfb\u52a0\u65b0\u7684\u952e\u503c\u5bf9\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">my_dict[&#39;city&#39;] = &#39;New York&#39;\n<\/code><\/pre>\n<p>\u6267\u884c\u540e\uff0c<code>my_dict<\/code> \u5c06\u5305\u542b\u4e00\u4e2a\u65b0\u7684\u952e <code>city<\/code> \u53ca\u5176\u5bf9\u5e94\u503c <code>New York<\/code>\uff0c\u8fd9\u4f7f\u5f97\u5b57\u5178\u53ef\u4ee5\u52a8\u6001\u6269\u5c55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5bf9\u5b57\u5178\u8d4b\u503c\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u5728\u5b57\u5178\u4e2d\u6307\u5b9a\u952e\u503c\u5bf9\u3001\u4f7f\u7528update()\u65b9\u6cd5\u66f4\u65b0\u5b57\u5178\u3001\u5229\u7528setdefa [&hellip;]","protected":false},"author":3,"featured_media":1020493,"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\/1020486"}],"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=1020486"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1020486\/revisions"}],"predecessor-version":[{"id":1020497,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1020486\/revisions\/1020497"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1020493"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1020486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1020486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1020486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}