{"id":1103363,"date":"2025-01-08T16:09:33","date_gmt":"2025-01-08T08:09:33","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1103363.html"},"modified":"2025-01-08T16:09:36","modified_gmt":"2025-01-08T08:09:36","slug":"python%e5%a6%82%e4%bd%95%e5%b0%86%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%8e%92%e5%88%97%e9%a1%ba%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1103363.html","title":{"rendered":"python\u5982\u4f55\u5c06\u5b57\u7b26\u4e32\u6392\u5217\u987a\u5e8f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25065222\/e5db87c6-d84d-4f9d-9454-2b9176df9852.webp\" alt=\"python\u5982\u4f55\u5c06\u5b57\u7b26\u4e32\u6392\u5217\u987a\u5e8f\" \/><\/p>\n<p><p> <strong>Python\u5c06\u5b57\u7b26\u4e32\u6392\u5217\u987a\u5e8f\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528sorted\u51fd\u6570\u3001\u4f7f\u7528join\u65b9\u6cd5\u3001\u4f7f\u7528\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u3002<\/strong> \u4e0b\u9762\u5c06\u8be6\u7ec6\u5c55\u5f00\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528sorted\u51fd\u6570\uff1a<\/strong> Python\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5185\u7f6e\u7684\u51fd\u6570sorted()\uff0c\u53ef\u4ee5\u7528\u4e8e\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u4e2a\u51fd\u6570\u4f1a\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u6309\u5b57\u6bcd\u987a\u5e8f\u6392\u5217\u7684\u5b57\u7b26\u4e32\u5b57\u7b26\u3002\u4f7f\u7528sorted()\u51fd\u6570\u7684\u4e00\u4e2a\u4f18\u70b9\u662f\u5b83\u4e0d\u4f1a\u6539\u53d8\u539f\u5b57\u7b26\u4e32\uff0c\u800c\u662f\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5217\u8868\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u9700\u8981\u4fdd\u6301\u539f\u59cb\u5b57\u7b26\u4e32\u4e0d\u53d8\uff0c\u540c\u65f6\u83b7\u5f97\u6392\u5e8f\u540e\u7684\u5b57\u7b26\u4e32\uff0c\u8fd9\u79cd\u65b9\u6cd5\u662f\u975e\u5e38\u5408\u9002\u7684\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>original_string = &quot;python&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1ahnopty<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u9996\u5148\u901a\u8fc7sorted()\u51fd\u6570\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff0c\u7136\u540e\u4f7f\u7528join()\u65b9\u6cd5\u5c06\u6392\u5e8f\u540e\u7684\u5b57\u7b26\u5217\u8868\u91cd\u65b0\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002\u6700\u7ec8\u7684\u8f93\u51fa\u662f\u4e00\u4e2a\u6309\u5b57\u6bcd\u987a\u5e8f\u6392\u5217\u7684\u65b0\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<hr>\n<p><h3>\u4e00\u3001\u4f7f\u7528 sorted() \u51fd\u6570<\/h3>\n<\/p>\n<p><p>sorted() \u662f\u4e00\u4e2a\u5185\u7f6e\u7684Python\u51fd\u6570\uff0c\u53ef\u4ee5\u5bf9\u4efb\u4f55\u53ef\u8fed\u4ee3\u5bf9\u8c61\u8fdb\u884c\u6392\u5e8f\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5217\u8868\u3002\u5bf9\u4e8e\u5b57\u7b26\u4e32\uff0c\u5b83\u4f1a\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e2a\u5b57\u7b26\u4f5c\u4e3a\u5355\u72ec\u7684\u5143\u7d20\u8fdb\u884c\u6392\u5e8f\uff0c\u7136\u540e\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">original_string = &quot;hello&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1aehllo<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>sorted()<\/code> \u51fd\u6570\u5c06\u5b57\u7b26\u4e32 &quot;hello&quot; \u4e2d\u7684\u6bcf\u4e2a\u5b57\u7b26\u6309\u5b57\u6bcd\u987a\u5e8f\u8fdb\u884c\u6392\u5e8f\uff0c\u7136\u540e <code>join()<\/code> \u65b9\u6cd5\u5c06\u6392\u5e8f\u540e\u7684\u5b57\u7b26\u5217\u8868\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;ehllo&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p><code>sorted()<\/code> \u51fd\u6570\u5728\u5185\u90e8\u4f7f\u7528\u4e86 Timsort \u7b97\u6cd5\uff0c\u8fd9\u662f\u4e00\u79cd\u6df7\u5408\u6392\u5e8f\u7b97\u6cd5\uff0c\u7ed3\u5408\u4e86\u5408\u5e76\u6392\u5e8f\u548c\u63d2\u5165\u6392\u5e8f\u7684\u4f18\u70b9\u3002\u5b83\u5177\u6709\u7a33\u5b9a\u6027\uff0c\u5373\u4e0d\u4f1a\u6539\u53d8\u76f8\u7b49\u5143\u7d20\u7684\u76f8\u5bf9\u987a\u5e8f\uff0c\u8fd9\u5bf9\u4e8e\u4e00\u4e9b\u5e94\u7528\u573a\u666f\u975e\u5e38\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528 join() \u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c<code>join()<\/code> \u65b9\u6cd5\u7528\u4e8e\u5c06\u53ef\u8fed\u4ee3\u5bf9\u8c61\u4e2d\u7684\u5143\u7d20\u8fde\u63a5\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u3002\u7ed3\u5408 <code>sorted()<\/code> \u51fd\u6570\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u5e76\u751f\u6210\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">original_string = &quot;python&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1ahnopty<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>sorted()<\/code> \u51fd\u6570\u5bf9\u5b57\u7b26\u4e32 &quot;python&quot; \u8fdb\u884c\u4e86\u6392\u5e8f\uff0c<code>join()<\/code> \u65b9\u6cd5\u5c06\u6392\u5e8f\u540e\u7684\u5b57\u7b26\u5217\u8868\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;hnopty&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p><code>join()<\/code> \u65b9\u6cd5\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u65b9\u6cd5\uff0c\u5b83\u63a5\u53d7\u4e00\u4e2a\u53ef\u8fed\u4ee3\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u5c06\u5176\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u8fde\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002\u5728\u4f7f\u7528 <code>sorted()<\/code> \u51fd\u6570\u6392\u5e8f\u5b57\u7b26\u4e32\u540e\uff0c<code>join()<\/code> \u65b9\u6cd5\u53ef\u4ee5\u9ad8\u6548\u5730\u5c06\u6392\u5e8f\u540e\u7684\u5b57\u7b26\u5217\u8868\u8fde\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528 <code>sorted()<\/code> \u51fd\u6570\uff0c\u8fd8\u53ef\u4ee5\u5b9a\u4e49\u81ea\u5df1\u7684\u6392\u5e8f\u51fd\u6570\u6765\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002\u901a\u8fc7\u5b9a\u4e49\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u6392\u5e8f\u51fd\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def custom_sort(char):<\/p>\n<p>    return ord(char)<\/p>\n<p>original_string = &quot;example&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=custom_sort))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1aaeelmpx<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u6392\u5e8f\u51fd\u6570 <code>custom_sort<\/code>\uff0c\u8be5\u51fd\u6570\u8fd4\u56de\u5b57\u7b26\u7684ASCII\u503c\u3002\u7136\u540e\uff0c\u4f7f\u7528 <code>sorted()<\/code> \u51fd\u6570\u548c <code>key<\/code> \u53c2\u6570\u6765\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff0c\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;aeelmpx&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u6839\u636e\u5b57\u7b26\u7684ASCII\u503c\u3001\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\u6216\u5176\u4ed6\u89c4\u5219\u8fdb\u884c\u6392\u5e8f\u3002\u901a\u8fc7\u4f20\u9012\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u7ed9 <code>sorted()<\/code> \u51fd\u6570\u7684 <code>key<\/code> \u53c2\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u5b57\u7b26\u4e32\u7684\u4e2a\u6027\u5316\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528 sorted() \u51fd\u6570\u8fdb\u884c\u9006\u5e8f\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u6309\u5b57\u6bcd\u987a\u5e8f\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 <code>sorted()<\/code> \u51fd\u6570\u8fdb\u884c\u9006\u5e8f\u6392\u5e8f\u3002\u901a\u8fc7\u4f20\u9012 <code>reverse=True<\/code> \u53c2\u6570\u7ed9 <code>sorted()<\/code> \u51fd\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u5b57\u7b26\u4e32\u7684\u9006\u5e8f\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">original_string = &quot;reverse&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, reverse=True))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1avsrreee<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>sorted()<\/code> \u51fd\u6570\u4f7f\u7528 <code>reverse=True<\/code> \u53c2\u6570\u5bf9\u5b57\u7b26\u4e32 &quot;reverse&quot; \u8fdb\u884c\u9006\u5e8f\u6392\u5e8f\uff0c\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;vsrreee&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p><code>sorted()<\/code> \u51fd\u6570\u7684 <code>reverse<\/code> \u53c2\u6570\u7528\u4e8e\u63a7\u5236\u6392\u5e8f\u7684\u987a\u5e8f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>reverse<\/code> \u53c2\u6570\u4e3a <code>False<\/code>\uff0c\u8868\u793a\u6309\u5347\u5e8f\u6392\u5e8f\u3002\u5f53 <code>reverse<\/code> \u53c2\u6570\u4e3a <code>True<\/code> \u65f6\uff0c<code>sorted()<\/code> \u51fd\u6570\u4f1a\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u964d\u5e8f\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528\u81ea\u5b9a\u4e49\u6392\u5e8f\u903b\u8f91\u8fdb\u884c\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528 <code>sorted()<\/code> \u51fd\u6570\u8fdb\u884c\u57fa\u7840\u6392\u5e8f\u5916\uff0c\u8fd8\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6392\u5e8f\u903b\u8f91\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u6839\u636e\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">from collections import Counter<\/p>\n<p>def frequency_sort(char):<\/p>\n<p>    return -char_count[char], char<\/p>\n<p>original_string = &quot;frequency&quot;<\/p>\n<p>char_count = Counter(original_string)<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=frequency_sort))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1aeeefnqruy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528 <code>collections.Counter<\/code> \u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2d\u6bcf\u4e2a\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\u3002\u7136\u540e\uff0c\u5b9a\u4e49\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570 <code>frequency_sort<\/code>\uff0c\u6839\u636e\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\u548c\u5b57\u7b26\u672c\u8eab\u8fdb\u884c\u6392\u5e8f\u3002\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;eeefnqruy&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u4f7f\u7528 <code>collections.Counter<\/code> \u8ba1\u7b97\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u6392\u5e8f\u3002\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570 <code>frequency_sort<\/code> \u4f7f\u7528\u5b57\u7b26\u7684\u51fa\u73b0\u9891\u7387\u548c\u5b57\u7b26\u672c\u8eab\u4f5c\u4e3a\u6392\u5e8f\u4f9d\u636e\uff0c\u5b9e\u73b0\u4e86\u66f4\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5904\u7406\u591a\u79cd\u5b57\u7b26\u7c7b\u578b\u7684\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5b57\u7b26\u4e32\u53ef\u80fd\u5305\u542b\u591a\u79cd\u5b57\u7b26\u7c7b\u578b\uff0c\u4f8b\u5982\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7\u3002\u5bf9\u4e8e\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def multi_type_sort(char):<\/p>\n<p>    if char.isdigit():<\/p>\n<p>        return (0, int(char))<\/p>\n<p>    elif char.isalpha():<\/p>\n<p>        return (1, char)<\/p>\n<p>    else:<\/p>\n<p>        return (2, char)<\/p>\n<p>original_string = &quot;a1b2c3!@#&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=multi_type_sort))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1a123abc!@#<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570 <code>multi_type_sort<\/code>\uff0c\u6839\u636e\u5b57\u7b26\u7c7b\u578b\u8fdb\u884c\u6392\u5e8f\u3002\u6570\u5b57\u5b57\u7b26\u6392\u5e8f\u4f18\u5148\u7ea7\u6700\u9ad8\uff0c\u5176\u6b21\u662f\u5b57\u6bcd\u5b57\u7b26\uff0c\u6700\u540e\u662f\u7b26\u53f7\u5b57\u7b26\u3002\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;123abc!@#&quot;<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\uff0c\u53ef\u4ee5\u6839\u636e\u5b57\u7b26\u7c7b\u578b\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002\u5728 <code>multi_type_sort<\/code> \u51fd\u6570\u4e2d\uff0c\u9996\u5148\u68c0\u67e5\u5b57\u7b26\u662f\u5426\u4e3a\u6570\u5b57\u5b57\u7b26\uff0c\u7136\u540e\u662f\u5b57\u6bcd\u5b57\u7b26\uff0c\u6700\u540e\u662f\u7b26\u53f7\u5b57\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u4e0d\u540c\u5b57\u7b26\u7c7b\u578b\u7684\u6392\u5e8f\u63a7\u5236\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u8fdb\u884c\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u5e94\u7528\u573a\u666f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\uff0c\u7136\u540e\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>original_string = &quot;Python3.8&quot;<\/p>\n<p>numbers = re.findall(r&#39;\\d&#39;, original_string)<\/p>\n<p>letters = re.findall(r&#39;[a-zA-Z]&#39;, original_string)<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(numbers) + sorted(letters))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1a38Phtony<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f <code>\\d<\/code> \u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u6570\u5b57\u5b57\u7b26\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f <code>[a-zA-Z]<\/code> \u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u6bcd\u5b57\u7b26\u3002\u7136\u540e\uff0c\u5206\u522b\u5bf9\u6570\u5b57\u5b57\u7b26\u548c\u5b57\u6bcd\u5b57\u7b26\u8fdb\u884c\u6392\u5e8f\uff0c\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;38Phtony&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u6587\u672c\u5904\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u5339\u914d\u548c\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u548c\u6392\u5e8f\u51fd\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u5b57\u7b26\u4e32\u4e2d\u4e0d\u540c\u7c7b\u578b\u5b57\u7b26\u7684\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u5904\u7406\u591a\u8bed\u8a00\u5b57\u7b26\u7684\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u591a\u8bed\u8a00\u5b57\u7b26\u6392\u5e8f\u65f6\uff0c\u53ef\u80fd\u9700\u8981\u8003\u8651\u5b57\u7b26\u7684Unicode\u503c\u3002\u53ef\u4ee5\u4f7f\u7528 <code>locale<\/code> \u6a21\u5757\u6839\u636e\u7279\u5b9a\u8bed\u8a00\u73af\u5883\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import locale<\/p>\n<p>original_string = &quot;\u00c5ngstr\u00f6m&quot;<\/p>\n<p>locale.setlocale(locale.LC_COLLATE, &#39;sv_SE.UTF-8&#39;)<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=locale.strxfrm))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1a\u00c5gmnrst\u00f6<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528 <code>locale<\/code> \u6a21\u5757\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883\u4e3a\u745e\u5178\u8bed\uff0c\u7136\u540e\u4f7f\u7528 <code>locale.strxfrm<\/code> \u51fd\u6570\u6839\u636e\u745e\u5178\u8bed\u6392\u5e8f\u89c4\u5219\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff0c\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;\u00c5gmnrst\u00f6&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p><code>locale<\/code> \u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u7ec4\u51fd\u6570\uff0c\u7528\u4e8e\u8bbe\u7f6e\u548c\u67e5\u8be2\u7a0b\u5e8f\u7684\u8bed\u8a00\u73af\u5883\u3002\u901a\u8fc7\u4f7f\u7528 <code>locale.setlocale<\/code> \u51fd\u6570\u53ef\u4ee5\u8bbe\u7f6e\u7279\u5b9a\u8bed\u8a00\u73af\u5883\uff0c\u7136\u540e\u4f7f\u7528 <code>locale.strxfrm<\/code> \u51fd\u6570\u6839\u636e\u8bed\u8a00\u73af\u5883\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u6837\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u591a\u8bed\u8a00\u5b57\u7b26\u7684\u6b63\u786e\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u4e5d\u3001\u4f7f\u7528sorted()\u51fd\u6570\u8fdb\u884c\u5ffd\u7565\u5927\u5c0f\u5199\u7684\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u65f6\u5ffd\u7565\u5927\u5c0f\u5199\u3002\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u5b9e\u73b0\u8fd9\u79cd\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">original_string = &quot;Python&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=lambda x: x.lower()))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1ahonPty<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528 <code>lambda<\/code> \u51fd\u6570\u5c06\u6bcf\u4e2a\u5b57\u7b26\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u7136\u540e\u8fdb\u884c\u6392\u5e8f\u3002\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;honPty&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u4f7f\u7528 <code>lambda<\/code> \u51fd\u6570\uff0c\u53ef\u4ee5\u5728\u6392\u5e8f\u65f6\u5c06\u6bcf\u4e2a\u5b57\u7b26\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u4ece\u800c\u5ffd\u7565\u5927\u5c0f\u5199\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5bf9\u5927\u5c0f\u5199\u4e0d\u654f\u611f\u7684\u5b57\u7b26\u4e32\u6392\u5e8f\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u3001\u4f7f\u7528 sorted() \u51fd\u6570\u8fdb\u884c\u591a\u91cd\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u591a\u91cd\u6392\u5e8f\u3002\u4f8b\u5982\uff0c\u5148\u6309\u5b57\u6bcd\u987a\u5e8f\u6392\u5e8f\uff0c\u7136\u540e\u6309\u5b57\u7b26\u51fa\u73b0\u9891\u7387\u6392\u5e8f\u3002\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u5b9e\u73b0\u591a\u91cd\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">from collections import Counter<\/p>\n<p>def multi_sort(char):<\/p>\n<p>    return (char, -char_count[char])<\/p>\n<p>original_string = &quot;banana&quot;<\/p>\n<p>char_count = Counter(original_string)<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=multi_sort))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1aaaannb<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570 <code>multi_sort<\/code>\uff0c\u5148\u6309\u5b57\u7b26\u6392\u5e8f\uff0c\u7136\u540e\u6309\u5b57\u7b26\u51fa\u73b0\u9891\u7387\u6392\u5e8f\u3002\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;aaannb&quot;\u3002<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\uff0c\u53ef\u4ee5\u5b9e\u73b0\u591a\u91cd\u6392\u5e8f\u9700\u6c42\u3002\u5728 <code>multi_sort<\/code> \u51fd\u6570\u4e2d\uff0c\u5148\u6309\u5b57\u7b26\u8fdb\u884c\u6392\u5e8f\uff0c\u7136\u540e\u6309\u5b57\u7b26\u51fa\u73b0\u9891\u7387\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u6837\u53ef\u4ee5\u5b9e\u73b0\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e00\u3001\u5904\u7406\u5305\u542b\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u7684\u5b57\u7b26\u4e32\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5b57\u7b26\u4e32\u53ef\u80fd\u5305\u542b\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u3002\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u5904\u7406\u8fd9\u4e9b\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def space_special_sort(char):<\/p>\n<p>    if char.isspace():<\/p>\n<p>        return (2, char)<\/p>\n<p>    elif char.isalnum():<\/p>\n<p>        return (0, char)<\/p>\n<p>    else:<\/p>\n<p>        return (1, char)<\/p>\n<p>original_string = &quot;a b!c&quot;<\/p>\n<p>sorted_string = &#39;&#39;.join(sorted(original_string, key=space_special_sort))<\/p>\n<p>print(sorted_string)  # \u8f93\u51fa\uff1aabc! <\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570 <code>space_special_sort<\/code>\uff0c\u6839\u636e\u5b57\u7b26\u7c7b\u578b\u8fdb\u884c\u6392\u5e8f\u3002\u7a7a\u683c\u5b57\u7b26\u6392\u5e8f\u4f18\u5148\u7ea7\u6700\u4f4e\uff0c\u5b57\u6bcd\u548c\u6570\u5b57\u5b57\u7b26\u6392\u5e8f\u4f18\u5148\u7ea7\u6700\u9ad8\uff0c\u7279\u6b8a\u5b57\u7b26\u6392\u5e8f\u4f18\u5148\u7ea7\u4e2d\u7b49\u3002\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32 &quot;abc! &quot;<\/p>\n<\/p>\n<p><h4>\u6df1\u5165\u89e3\u6790<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\uff0c\u53ef\u4ee5\u5904\u7406\u5305\u542b\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u7684\u5b57\u7b26\u4e32\u6392\u5e8f\u3002\u5728 <code>space_special_sort<\/code> \u51fd\u6570\u4e2d\uff0c\u6839\u636e\u5b57\u7b26\u7c7b\u578b\u8bbe\u7f6e\u6392\u5e8f\u4f18\u5148\u7ea7\uff0c\u4ece\u800c\u5b9e\u73b0\u5bf9\u4e0d\u540c\u7c7b\u578b\u5b57\u7b26\u7684\u6392\u5e8f\u63a7\u5236\u3002<\/p>\n<\/p>\n<p><h3>\u5341\u4e8c\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86Python\u4e2d\u5c06\u5b57\u7b26\u4e32\u6392\u5217\u987a\u5e8f\u7684\u591a\u79cd\u65b9\u6cd5\uff0c\u5305\u62ec\u4f7f\u7528sorted\u51fd\u6570\u3001join\u65b9\u6cd5\u3001\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u3001\u9006\u5e8f\u6392\u5e8f\u3001\u591a\u79cd\u5b57\u7b26\u7c7b\u578b\u6392\u5e8f\u3001\u6b63\u5219\u8868\u8fbe\u5f0f\u6392\u5e8f\u3001\u591a\u8bed\u8a00\u5b57\u7b26\u6392\u5e8f\u3001\u5ffd\u7565\u5927\u5c0f\u5199\u6392\u5e8f\u3001\u591a\u91cd\u6392\u5e8f\uff0c\u4ee5\u53ca\u5904\u7406\u5305\u542b\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u7684\u6392\u5e8f\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff0c\u5b9e\u73b0\u590d\u6742\u7684\u6392\u5e8f\u903b\u8f91\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff0c\u80fd\u591f\u66f4\u597d\u5730\u7406\u89e3\u548c\u5e94\u7528Python\u4e2d\u7684\u5b57\u7b26\u4e32\u6392\u5e8f\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>sorted()<\/code>\u51fd\u6570\u5bf9\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u8fdb\u884c\u6392\u5e8f\u3002\u8be5\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5b57\u7b26\u5217\u8868\uff0c\u5e76\u8fd4\u56de\u4e00\u4e2a\u6392\u5e8f\u540e\u7684\u5217\u8868\u3002\u53ef\u4ee5\u4f7f\u7528<code>join()<\/code>\u65b9\u6cd5\u5c06\u6392\u5e8f\u540e\u7684\u5217\u8868\u91cd\u65b0\u7ec4\u5408\u4e3a\u5b57\u7b26\u4e32\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">original_string = &quot;python&quot;\nsorted_string = &#39;&#39;.join(sorted(original_string))\nprint(sorted_string)  # \u8f93\u51fa: hnopty\n<\/code><\/pre>\n<p><strong>\u4f7f\u7528Python\u5bf9\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u8fdb\u884c\u6392\u5e8f\u7684\u65b9\u6cd5\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u8981\u5bf9\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u8fdb\u884c\u6392\u5e8f\uff0c\u53ef\u4ee5\u5148\u4f7f\u7528<code>split()<\/code>\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u6309\u7a7a\u683c\u5206\u5272\u6210\u5355\u8bcd\u5217\u8868\uff0c\u7136\u540e\u4f7f\u7528<code>sorted()<\/code>\u51fd\u6570\u5bf9\u8fd9\u4e9b\u5355\u8bcd\u8fdb\u884c\u6392\u5e8f\u3002\u6700\u540e\uff0c\u518d\u4f7f\u7528<code>join()<\/code>\u65b9\u6cd5\u5c06\u6392\u5e8f\u540e\u7684\u5355\u8bcd\u5217\u8868\u7ec4\u5408\u6210\u5b57\u7b26\u4e32\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">sentence = &quot;python is a programming language&quot;\nsorted_words = &#39; &#39;.join(sorted(sentence.split()))\nprint(sorted_words)  # \u8f93\u51fa: a language is programming python\n<\/code><\/pre>\n<p><strong>Python\u4e2d\u662f\u5426\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6392\u5e8f\u89c4\u5219\u4ee5\u6392\u5217\u5b57\u7b26\u4e32\uff1f<\/strong><br \/>\u786e\u5b9e\u53ef\u4ee5\u3002\u5728\u4f7f\u7528<code>sorted()<\/code>\u51fd\u6570\u65f6\uff0c\u53ef\u4ee5\u5229\u7528<code>key<\/code>\u53c2\u6570\u6765\u6307\u5b9a\u81ea\u5b9a\u4e49\u7684\u6392\u5e8f\u89c4\u5219\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u6309\u5355\u8bcd\u7684\u957f\u5ea6\u8fdb\u884c\u6392\u5e8f\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">sentence = &quot;python is a programming language&quot;\nsorted_by_length = &#39; &#39;.join(sorted(sentence.split(), key=len))\nprint(sorted_by_length)  # \u8f93\u51fa: a is python language programming\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u66f4\u5927\u7684\u7075\u6d3b\u6027\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u7684\u6392\u5e8f\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5c06\u5b57\u7b26\u4e32\u6392\u5217\u987a\u5e8f\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528sorted\u51fd\u6570\u3001\u4f7f\u7528join\u65b9\u6cd5\u3001\u4f7f\u7528\u81ea\u5b9a\u4e49\u6392\u5e8f\u51fd\u6570\u3002 \u4e0b\u9762\u5c06\u8be6\u7ec6 [&hellip;]","protected":false},"author":3,"featured_media":1103372,"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\/1103363"}],"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=1103363"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1103363\/revisions"}],"predecessor-version":[{"id":1103373,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1103363\/revisions\/1103373"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1103372"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1103363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1103363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1103363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}