{"id":1012835,"date":"2024-12-27T11:42:40","date_gmt":"2024-12-27T03:42:40","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1012835.html"},"modified":"2024-12-27T11:42:43","modified_gmt":"2024-12-27T03:42:43","slug":"python%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8unicode%e6%8e%92%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1012835.html","title":{"rendered":"python\u5982\u4f55\u4f7f\u7528unicode\u6392\u5e8f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25090450\/654cbd06-3f98-450e-8180-595f75ac714a.webp\" alt=\"python\u5982\u4f55\u4f7f\u7528unicode\u6392\u5e8f\" \/><\/p>\n<p><p> <strong>Python\u4f7f\u7528Unicode\u6392\u5e8f\u7684\u5173\u952e\u5728\u4e8e\uff1a\u4f7f\u7528sorted()\u51fd\u6570\u3001\u501f\u52a9locale\u6a21\u5757\u3001\u5229\u7528unicodedata\u6a21\u5757\u3002<\/strong>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u5904\u7406Unicode\u5b57\u7b26\u4e32\u7684\u6392\u5e8f\u95ee\u9898\uff0c\u5177\u4f53\u7684\u65b9\u6cd5\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u7684\u4e0d\u540c\u800c\u6709\u6240\u9009\u62e9\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e09\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528sorted()\u51fd\u6570\u8fdb\u884c\u7b80\u5355\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c<code>sorted()<\/code>\u51fd\u6570\u662f\u4e00\u4e2a\u975e\u5e38\u65b9\u4fbf\u7684\u6392\u5e8f\u5de5\u5177\u3002\u5b83\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\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>sorted()<\/code>\u51fd\u6570\u4f1a\u4f7f\u7528Unicode\u7801\u70b9\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u6392\u5e8f\u3002\u8fd9\u79cd\u6392\u5e8f\u65b9\u5f0f\u5bf9\u5927\u591a\u6570\u7b80\u5355\u7684Unicode\u6392\u5e8f\u9700\u6c42\u5df2\u7ecf\u8db3\u591f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>words = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;, &#39;date&#39;]<\/p>\n<p>sorted_words = sorted(words)<\/p>\n<p>print(sorted_words)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>sorted()<\/code>\u51fd\u6570\u6309\u7167\u5b57\u6bcd\u987a\u5e8f\u5bf9\u5217\u8868\u8fdb\u884c\u6392\u5e8f\u3002\u4e0d\u8fc7\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u76f4\u63a5\u4f7f\u7528<code>sorted()<\/code>\u8fdb\u884cUnicode\u6392\u5e8f\u65f6\uff0c\u67d0\u4e9b\u8bed\u8a00\u53ef\u80fd\u4e0d\u7b26\u5408\u4eba\u4eec\u7684\u4e60\u60ef\u6392\u5e8f\u89c4\u5219\u3002\u4f8b\u5982\uff0c\u5fb7\u8bed\u4e2d\u7684\u5b57\u7b26\u201c\u00e4\u201d\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u88ab\u8ba4\u4e3a\u5e94\u8be5\u6392\u5728\u201ca\u201d\u4e4b\u540e\u800c\u975e\u201cz\u201d\u4e4b\u540e\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528locale\u6a21\u5757\u8fdb\u884c\u672c\u5730\u5316\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>Python\u7684<code>locale<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u79cd\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u672c\u5730\u5316\u6392\u5e8f\u7684\u65b9\u6cd5\u3002\u8fd9\u5bf9\u591a\u8bed\u8a00\u73af\u5883\u975e\u5e38\u6709\u7528\uff0c\u56e0\u4e3a\u4e0d\u540c\u8bed\u8a00\u548c\u6587\u5316\u53ef\u80fd\u6709\u4e0d\u540c\u7684\u6392\u5e8f\u89c4\u5219\u3002<\/p>\n<\/p>\n<p><h4>1. \u8bbe\u7f6e\u8bed\u8a00\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>locale.setlocale()<\/code>\u51fd\u6570\u6765\u8bbe\u7f6e\u8bed\u8a00\u73af\u5883\u3002\u8fd9\u5c06\u5f71\u54cd\u5230\u5b57\u7b26\u4e32\u7684\u6392\u5e8f\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import locale<\/p>\n<h2><strong>\u8bbe\u7f6e\u4e3a\u5fb7\u56fd\u7684\u672c\u5730\u5316\u73af\u5883<\/strong><\/h2>\n<p>locale.setlocale(locale.LC_COLLATE, &#39;de_DE.UTF-8&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528locale.strxfrm()\u8fdb\u884c\u6392\u5e8f<\/h4>\n<\/p>\n<p><p>\u4e00\u65e6\u8bbe\u7f6e\u4e86\u8bed\u8a00\u73af\u5883\uff0c\u53ef\u4ee5\u4f7f\u7528<code>locale.strxfrm()<\/code>\u51fd\u6570\u6765\u8f6c\u6362\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>words = [&#39;\u00e4pfel&#39;, &#39;apfel&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>sorted_words = sorted(words, key=locale.strxfrm)<\/p>\n<p>print(sorted_words)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u4f7f\u7528<code>locale.strxfrm()<\/code>\u51fd\u6570\uff0cPython\u80fd\u591f\u6839\u636e\u5fb7\u56fd\u7684\u5b57\u6bcd\u8868\u987a\u5e8f\u6765\u6b63\u786e\u6392\u5e8f\u3002<\/p>\n<\/p>\n<p><h4>3. \u6ce8\u610f\u4e8b\u9879<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>locale<\/code>\u6a21\u5757\u65f6\uff0c\u786e\u4fdd\u7cfb\u7edf\u652f\u6301\u6240\u9700\u7684\u8bed\u8a00\u73af\u5883\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5\u989d\u5916\u7684\u8bed\u8a00\u5305\u3002\u6b64\u5916\uff0c<code>locale<\/code>\u6a21\u5757\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8bed\u8a00\u73af\u5883\u8bbe\u7f6e\u800c\u5f71\u54cd\u5176\u4ed6\u4ee3\u7801\u7684\u6267\u884c\uff0c\u56e0\u6b64\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e2d\u9700\u5c0f\u5fc3\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528unicodedata\u6a21\u5757\u8fdb\u884c\u81ea\u5b9a\u4e49\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u7cbe\u7ec6\u63a7\u5236\u7684Unicode\u6392\u5e8f\uff0c<code>unicodedata<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u66f4\u5927\u7684\u7075\u6d3b\u6027\u3002\u901a\u8fc7\u8fd9\u4e2a\u6a21\u5757\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95ee\u6bcf\u4e2a\u5b57\u7b26\u7684Unicode\u5c5e\u6027\u3002<\/p>\n<\/p>\n<p><h4>1. \u83b7\u53d6Unicode\u5b57\u7b26\u7684\u89c4\u8303\u5f62\u5f0f<\/h4>\n<\/p>\n<p><p><code>unicodedata<\/code>\u6a21\u5757\u5141\u8bb8\u4f60\u83b7\u53d6\u5b57\u7b26\u7684\u89c4\u8303\u5f62\u5f0f\uff0c\u4f8b\u5982\u89c4\u8303\u5206\u89e3\u5f62\u5f0f\uff08NFD\uff09\u6216\u89c4\u8303\u5408\u6210\u5f62\u5f0f\uff08NFC\uff09\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import unicodedata<\/p>\n<h2><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/h2>\n<p>s = &#39;caf\u00e9&#39;<\/p>\n<p>normalized_s = unicodedata.normalize(&#39;NFD&#39;, s)<\/p>\n<p>print(normalized_s)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u4f7f\u7528unicodedata\u63d0\u4f9b\u7684\u5c5e\u6027\u8fdb\u884c\u6392\u5e8f<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u6839\u636e\u5b57\u7b26\u7684Unicode\u5c5e\u6027\u8fdb\u884c\u6392\u5e8f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u5b57\u7b26\u7684\u540d\u79f0\u6216\u7c7b\u522b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>words = [&#39;caf\u00e9&#39;, &#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>sorted_words = sorted(words, key=lambda x: unicodedata.normalize(&#39;NFD&#39;, x))<\/p>\n<p>print(sorted_words)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u66f4\u52a0\u7cbe\u7ec6\u5730\u63a7\u5236\u6392\u5e8f\u89c4\u5219\uff0c\u9002\u5e94\u7279\u6b8a\u7684\u6392\u5e8f\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001Unicode\u6392\u5e8f\u4e2d\u7684\u5e38\u89c1\u95ee\u9898<\/h3>\n<\/p>\n<p><h4>1. \u591a\u8bed\u8a00\u6392\u5e8f<\/h4>\n<\/p>\n<p><p>\u5728\u591a\u8bed\u8a00\u6587\u672c\u4e2d\u6392\u5e8f\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u3002\u4e0d\u540c\u8bed\u8a00\u7684\u5b57\u7b26\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u6392\u5e8f\u89c4\u5219\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7ed3\u5408<code>locale<\/code>\u548c<code>unicodedata<\/code>\u6a21\u5757\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<p><h4>2. \u7279\u6b8a\u5b57\u7b26\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u67d0\u4e9b\u7279\u6b8a\u5b57\u7b26\uff08\u4f8b\u5982\u91cd\u97f3\u7b26\u53f7\u3001\u5408\u6210\u5b57\u7b26\u7b49\uff09\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6392\u5e8f\u95ee\u9898\u3002\u4f7f\u7528Unicode\u89c4\u8303\u5316\u53ef\u4ee5\u5e2e\u52a9\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u6027\u80fd\u8003\u8651<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u96c6\u65f6\uff0c\u6392\u5e8f\u7684\u6027\u80fd\u53ef\u80fd\u6210\u4e3a\u4e00\u4e2a\u95ee\u9898\u3002\u4f7f\u7528<code>sorted()<\/code>\u51fd\u6570\u8fdb\u884c\u7b80\u5355\u6392\u5e8f\u901a\u5e38\u8db3\u591f\u9ad8\u6548\uff0c\u800c\u4f7f\u7528<code>locale<\/code>\u548c<code>unicodedata<\/code>\u6a21\u5757\u53ef\u80fd\u4f1a\u589e\u52a0\u989d\u5916\u7684\u8ba1\u7b97\u5f00\u9500\u3002\u56e0\u6b64\uff0c\u5728\u9009\u62e9\u6392\u5e8f\u65b9\u6cd5\u65f6\uff0c\u52a1\u5fc5\u6743\u8861\u6027\u80fd\u548c\u6392\u5e8f\u7cbe\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b9e\u9645\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><h4>1. \u6570\u636e\u5e93\u6392\u5e8f<\/h4>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5e93\u4e2d\u5b58\u50a8\u548c\u68c0\u7d22\u591a\u8bed\u8a00\u6570\u636e\u65f6\uff0c\u6b63\u786e\u7684\u6392\u5e8f\u548c\u6bd4\u8f83\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u53ef\u4ee5\u5728\u6570\u636e\u5e93\u5c42\u9762\u4f7f\u7528\u76f8\u5e94\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u6216\u8005\u5728\u5e94\u7528\u5c42\u4f7f\u7528Python\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h4>2. \u7528\u6237\u754c\u9762\u6392\u5e8f<\/h4>\n<\/p>\n<p><p>\u5728\u7528\u6237\u754c\u9762\u4e2d\u663e\u793a\u591a\u8bed\u8a00\u6587\u672c\u65f6\uff0c\u7528\u6237\u671f\u671b\u770b\u5230\u7b26\u5408\u5176\u8bed\u8a00\u4e60\u60ef\u7684\u6392\u5e8f\u7ed3\u679c\u3002\u6b64\u65f6\uff0c\u4f7f\u7528<code>locale<\/code>\u6a21\u5757\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u5f0f\u6765\u5904\u7406Unicode\u5b57\u7b26\u4e32\u7684\u6392\u5e8f\u95ee\u9898\u3002\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u7b80\u5355\u7684<code>sorted()<\/code>\u51fd\u6570\u3001<code>locale<\/code>\u6a21\u5757\u6216\u8005<code>unicodedata<\/code>\u6a21\u5757\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u7f3a\u70b9\u548c\u9002\u7528\u573a\u666f\u3002\u5728\u591a\u8bed\u8a00\u73af\u5883\u4e2d\uff0c\u9009\u62e9\u6b63\u786e\u7684\u6392\u5e8f\u65b9\u6cd5\u5bf9\u5b9e\u73b0\u7b26\u5408\u7528\u6237\u671f\u671b\u7684\u6392\u5e8f\u7ed3\u679c\u81f3\u5173\u91cd\u8981\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u7ed3\u5408\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u51b3Unicode\u6392\u5e8f\u95ee\u9898\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0Unicode\u6392\u5e8f\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5185\u7f6e\u7684<code>sorted()<\/code>\u51fd\u6570\u7ed3\u5408<code>str<\/code>\u7c7b\u578b\u7684<code>ord()<\/code>\u51fd\u6570\u6765\u5b9e\u73b0Unicode\u6392\u5e8f\u3002\u5177\u4f53\u800c\u8a00\uff0c\u4f7f\u7528<code>sorted()<\/code>\u51fd\u6570\u53ef\u4ee5\u5bf9\u5b57\u7b26\u4e32\u5217\u8868\u8fdb\u884c\u6392\u5e8f\uff0c\u7cfb\u7edf\u4f1a\u6839\u636eUnicode\u503c\u81ea\u52a8\u8fdb\u884c\u6392\u5e8f\u3002\u4f8b\u5982\uff0c<code>sorted([&#39;a&#39;, &#39;\u00e9&#39;, &#39;c&#39;, &#39;b&#39;])<\/code>\u4f1a\u8fd4\u56de<code>[&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;\u00e9&#39;]<\/code>\uff0c\u56e0\u4e3a\u5b83\u4eec\u7684Unicode\u503c\u6309\u987a\u5e8f\u6392\u5217\u3002<\/p>\n<p><strong>Unicode\u6392\u5e8f\u548c\u666e\u901a\u6392\u5e8f\u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/strong><br \/>Unicode\u6392\u5e8f\u8003\u8651\u4e86\u5b57\u7b26\u7684Unicode\u7f16\u7801\uff0c\u8fd9\u610f\u5473\u7740\u5b57\u7b26\u7684\u6392\u5e8f\u987a\u5e8f\u53ef\u80fd\u4e0e\u5b57\u6bcd\u8868\u987a\u5e8f\u4e0d\u540c\u3002\u4f8b\u5982\uff0c\u5728\u67d0\u4e9b\u8bed\u8a00\u4e2d\uff0c\u67d0\u4e9b\u7279\u6b8a\u5b57\u7b26\u7684Unicode\u503c\u53ef\u80fd\u4f1a\u5f71\u54cd\u5b83\u4eec\u5728\u6392\u5e8f\u5217\u8868\u4e2d\u7684\u4f4d\u7f6e\u3002\u666e\u901a\u6392\u5e8f\u901a\u5e38\u4f9d\u8d56\u4e8e\u5b57\u6bcd\u8868\u987a\u5e8f\uff0c\u53ef\u80fd\u65e0\u6cd5\u5904\u7406\u4e0d\u540c\u8bed\u8a00\u5b57\u7b26\u7684\u590d\u6742\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u5305\u542b\u4e0d\u540c\u8bed\u8a00\u5b57\u7b26\u7684Unicode\u6392\u5e8f\uff1f<\/strong><br \/>\u5904\u7406\u5305\u542b\u4e0d\u540c\u8bed\u8a00\u5b57\u7b26\u7684Unicode\u6392\u5e8f\u53ef\u4ee5\u4f7f\u7528<code>locale<\/code>\u6a21\u5757\u6765\u786e\u4fdd\u6309\u7167\u6307\u5b9a\u8bed\u8a00\u7684\u89c4\u5219\u8fdb\u884c\u6392\u5e8f\u3002\u901a\u8fc7\u8bbe\u7f6e\u5408\u9002\u7684\u533a\u57df\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u4f7f\u6392\u5e8f\u7ed3\u679c\u66f4\u7b26\u5408\u7528\u6237\u7684\u9884\u671f\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>locale.strxfrm<\/code>\u51fd\u6570\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u9002\u5408\u6392\u5e8f\u7684\u683c\u5f0f\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u51c6\u786e\u7684\u6392\u5e8f\u7ed3\u679c\u3002\u786e\u4fdd\u5728\u6392\u5e8f\u524d\u8c03\u7528<code>locale.setlocale()<\/code>\u4ee5\u8bbe\u7f6e\u6b63\u786e\u7684\u8bed\u8a00\u73af\u5883\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u907f\u514dUnicode\u6392\u5e8f\u4e2d\u7684\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u8fdb\u884cUnicode\u6392\u5e8f\u65f6\uff0c\u786e\u4fdd\u6240\u6709\u5b57\u7b26\u4e32\u90fd\u5df2\u7ecf\u6807\u51c6\u5316\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u4f7f\u7528<code>unicodedata<\/code>\u6a21\u5757\u4e2d\u7684<code>normalize()<\/code>\u51fd\u6570\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u89c4\u8303\u5316\u4e3a\u76f8\u540c\u7684\u683c\u5f0f\uff0c\u4ece\u800c\u907f\u514d\u56e0\u4e3a\u4e0d\u540c\u7684\u5b57\u7b26\u8868\u793a\u5f62\u5f0f\u800c\u5bfc\u81f4\u7684\u6392\u5e8f\u9519\u8bef\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u5904\u7406\u5b57\u7b26\u4e32\u65f6\u8003\u8651\u5230\u5927\u5c0f\u5199\uff0c\u53ef\u80fd\u9700\u8981\u7edf\u4e00\u8f6c\u6362\u4e3a\u5c0f\u5199\u6216\u5927\u5199\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4f7f\u7528Unicode\u6392\u5e8f\u7684\u5173\u952e\u5728\u4e8e\uff1a\u4f7f\u7528sorted()\u51fd\u6570\u3001\u501f\u52a9locale\u6a21\u5757\u3001\u5229\u7528unicod [&hellip;]","protected":false},"author":3,"featured_media":1012843,"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\/1012835"}],"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=1012835"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012835\/revisions"}],"predecessor-version":[{"id":1012845,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1012835\/revisions\/1012845"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1012843"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1012835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1012835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1012835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}