{"id":1076939,"date":"2025-01-08T11:57:47","date_gmt":"2025-01-08T03:57:47","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1076939.html"},"modified":"2025-01-08T11:57:49","modified_gmt":"2025-01-08T03:57:49","slug":"python%e5%a6%82%e4%bd%95%e5%8e%bb%e6%8e%89%e5%87%a0%e4%b8%aa%e5%ad%97%e7%ac%a6-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1076939.html","title":{"rendered":"python\u5982\u4f55\u53bb\u6389\u51e0\u4e2a\u5b57\u7b26"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181243\/1e03fde0-7a61-4fd8-a569-f0f6a980ea64.webp\" alt=\"python\u5982\u4f55\u53bb\u6389\u51e0\u4e2a\u5b57\u7b26\" \/><\/p>\n<p><p> <strong>Python\u53bb\u6389\u51e0\u4e2a\u5b57\u7b26\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247\u3001replace()\u65b9\u6cd5\u3001re\u6a21\u5757\u3001str.translate()\u65b9\u6cd5<\/strong>\u3002\u5176\u4e2d\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247\u662f\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247\u53ef\u4ee5\u975e\u5e38\u65b9\u4fbf\u5730\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u67d0\u4e9b\u5b57\u7b26\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e\u6765\u63d0\u53d6\u6211\u4eec\u9700\u8981\u7684\u90e8\u5206\uff0c\u7136\u540e\u91cd\u65b0\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u6211\u4eec\u60f3\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u524d\u540e\u51e0\u4e2a\u5b57\u7b26\uff0c\u53ef\u4ee5\u8fd9\u6837\u64cd\u4f5c\uff1a\u5b57\u7b26\u4e32\u5207\u7247\u7684\u8bed\u6cd5\u662fstring[start:end]\uff0c\u5176\u4e2dstart\u662f\u5f00\u59cb\u7d22\u5f15\uff0cend\u662f\u7ed3\u675f\u7d22\u5f15\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5b57\u7b26\u4e32\u7684\u7d22\u5f15\u662f\u4ece0\u5f00\u59cb\u7684\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u6709\u4e00\u4e2a\u5b57\u7b26\u4e32<code>str = &quot;Hello, World!&quot;<\/code>\uff0c\u5982\u679c\u6211\u4eec\u60f3\u53bb\u6389\u524d\u540e\u7684\u4e24\u4e2a\u5b57\u7b26\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>new_str = str[2:-2]<\/p>\n<p>print(new_str)  # llo, Wor<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u5207\u7247\u64cd\u4f5c<code>str[2:-2]<\/code>\uff0c\u5b83\u63d0\u53d6\u7684\u662f\u4ece\u7d22\u5f152\u5230\u7d22\u5f15-2\uff08\u4e0d\u5305\u62ec\u7d22\u5f15-2\uff09\u7684\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecdPython\u4e2d\u53bb\u6389\u51e0\u4e2a\u5b57\u7b26\u7684\u5404\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u4e00\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247<\/strong><\/h2>\n<p><h2>1.1 \u53bb\u6389\u524dn\u4e2a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u5b57\u7b26\u4e32\u5207\u7247\u662f\u4e00\u79cd\u975e\u5e38\u76f4\u89c2\u7684\u65b9\u6cd5\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e\u6765\u63d0\u53d6\u6211\u4eec\u9700\u8981\u7684\u90e8\u5206\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>n = 2<\/p>\n<p>new_str = str[n:]<\/p>\n<p>print(new_str)  # llo, World!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str[n:]<\/code>\u8868\u793a\u4ece\u7d22\u5f15<code>n<\/code>\u5230\u5b57\u7b26\u4e32\u7684\u672b\u5c3e\u7684\u6240\u6709\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>1.2 \u53bb\u6389\u540en\u4e2a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5207\u7247\u64cd\u4f5c\u53bb\u6389\u5b57\u7b26\u4e32\u672b\u5c3e\u7684n\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>n = 2<\/p>\n<p>new_str = str[:-n]<\/p>\n<p>print(new_str)  # Hello, Worl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str[:-n]<\/code>\u8868\u793a\u4ece\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u5230\u7d22\u5f15<code>-n<\/code>\uff08\u4e0d\u5305\u62ec\u7d22\u5f15<code>-n<\/code>\uff09\u7684\u6240\u6709\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>1.3 \u53bb\u6389\u524d\u540en\u4e2a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6709\u65f6\u5019\u6211\u4eec\u53ef\u80fd\u9700\u8981\u540c\u65f6\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u524d\u540e\u51e0\u4e2a\u5b57\u7b26\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u7ec4\u5408\u5207\u7247\u64cd\u4f5c\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>n = 2<\/p>\n<p>new_str = str[n:-n]<\/p>\n<p>print(new_str)  # llo, Wor<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str[n:-n]<\/code>\u8868\u793a\u4ece\u7d22\u5f15<code>n<\/code>\u5230\u7d22\u5f15<code>-n<\/code>\uff08\u4e0d\u5305\u62ec\u7d22\u5f15<code>-n<\/code>\uff09\u7684\u6240\u6709\u5b57\u7b26\u3002<\/p>\n<\/p>\n<h2><strong>\u4e8c\u3001\u4f7f\u7528replace()\u65b9\u6cd5<\/strong><\/h2>\n<p><p><code>replace()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u7528\u6765\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u67d0\u4e9b\u5b57\u7b26\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u66ff\u6362\u7279\u5b9a\u7684\u5b57\u7b26\u4e3a\u7a7a\u5b57\u7b26\u4e32\u6765\u5b9e\u73b0\u53bb\u6389\u5b57\u7b26\u7684\u76ee\u7684\u3002<\/p>\n<\/p>\n<p><h2>2.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>replace()<\/code>\u65b9\u6cd5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = str.replace(char_to_remove, &quot;&quot;)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str.replace(char_to_remove, &quot;&quot;)<\/code>\u8868\u793a\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709<code>char_to_remove<\/code>\u5b57\u7b26\u66ff\u6362\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>2.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u5982\u679c\u6211\u4eec\u9700\u8981\u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code>replace()<\/code>\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>new_str = str.replace(&quot;l&quot;, &quot;&quot;).replace(&quot;o&quot;, &quot;&quot;)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u4e24\u4e2a<code>replace()<\/code>\u65b9\u6cd5\uff0c\u5148\u53bb\u6389\u5b57\u7b26<code>l<\/code>\uff0c\u7136\u540e\u53bb\u6389\u5b57\u7b26<code>o<\/code>\u3002<\/p>\n<\/p>\n<h2><strong>\u4e09\u3001\u4f7f\u7528re\u6a21\u5757<\/strong><\/h2>\n<p><p><code>re<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u5b57\u7b26\u4e32\u5904\u7406\u529f\u80fd\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u548c\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u67d0\u4e9b\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>3.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>re.sub()<\/code>\u65b9\u6cd5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = re.sub(char_to_remove, &quot;&quot;, str)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>re.sub(char_to_remove, &quot;&quot;, str)<\/code>\u8868\u793a\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709<code>char_to_remove<\/code>\u5b57\u7b26\u66ff\u6362\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>3.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\uff0c\u7136\u540e\u53bb\u6389\u5b83\u4eec\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;[lo]&quot;<\/p>\n<p>new_str = re.sub(chars_to_remove, &quot;&quot;, str)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>re.sub(chars_to_remove, &quot;&quot;, str)<\/code>\u8868\u793a\u5c06\u5b57\u7b26\u4e32\u4e2d\u7684\u6240\u6709\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f<code>chars_to_remove<\/code>\u7684\u5b57\u7b26\u66ff\u6362\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<h2><strong>\u56db\u3001\u4f7f\u7528str.translate()\u65b9\u6cd5<\/strong><\/h2>\n<p><p><code>str.translate()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u7528\u6765\u6839\u636e\u6307\u5b9a\u7684\u6620\u5c04\u8868\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u6620\u5c04\u8868\uff0c\u5c06\u9700\u8981\u53bb\u6389\u7684\u5b57\u7b26\u6620\u5c04\u4e3a\u7a7a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>4.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>str.translate()<\/code>\u65b9\u6cd5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;l&quot;<\/p>\n<p>translation_table = str.maketrans(&quot;&quot;, &quot;&quot;, chars_to_remove)<\/p>\n<p>new_str = str.translate(translation_table)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str.maketrans(&quot;&quot;, &quot;&quot;, chars_to_remove)<\/code>\u521b\u5efa\u4e86\u4e00\u4e2a\u6620\u5c04\u8868\uff0c\u5c06\u5b57\u7b26<code>l<\/code>\u6620\u5c04\u4e3a\u7a7a\u5b57\u7b26\uff0c<code>str.translate(translation_table)<\/code>\u8868\u793a\u6839\u636e\u6620\u5c04\u8868\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>4.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u6620\u5c04\u8868\uff0c\u5c06\u9700\u8981\u53bb\u6389\u7684\u591a\u4e2a\u5b57\u7b26\u6620\u5c04\u4e3a\u7a7a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>translation_table = str.maketrans(&quot;&quot;, &quot;&quot;, chars_to_remove)<\/p>\n<p>new_str = str.translate(translation_table)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>str.maketrans(&quot;&quot;, &quot;&quot;, chars_to_remove)<\/code>\u521b\u5efa\u4e86\u4e00\u4e2a\u6620\u5c04\u8868\uff0c\u5c06\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\u6620\u5c04\u4e3a\u7a7a\u5b57\u7b26\uff0c<code>str.translate(translation_table)<\/code>\u8868\u793a\u6839\u636e\u6620\u5c04\u8868\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26\u3002<\/p>\n<\/p>\n<h2><strong>\u4e94\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u62fc\u63a5<\/strong><\/h2>\n<p><p>\u9664\u4e86\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5b57\u7b26\u4e32\u62fc\u63a5\u7684\u65b9\u5f0f\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u67d0\u4e9b\u5b57\u7b26\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u4e00\u4e9b\u7b80\u5355\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h2>5.1 \u53bb\u6389\u524dn\u4e2a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b57\u7b26\u4e32\u62fc\u63a5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u524dn\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>n = 2<\/p>\n<p>new_str = str[:n] + str[n+1:]<\/p>\n<p>print(new_str)  # Hllo, World!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u62fc\u63a5\u5b57\u7b26\u4e32\u7684\u524dn\u4e2a\u5b57\u7b26\u548c\u4ece\u7d22\u5f15<code>n+1<\/code>\u5f00\u59cb\u7684\u5b57\u7b26\u6765\u53bb\u6389\u7b2cn\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>5.2 \u53bb\u6389\u540en\u4e2a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5b57\u7b26\u4e32\u62fc\u63a5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u540en\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>n = 2<\/p>\n<p>new_str = str[:-n-1] + str[-n:]<\/p>\n<p>print(new_str)  # Hello, Wold!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u62fc\u63a5\u5b57\u7b26\u4e32\u7684\u524d<code>-n-1<\/code>\u4e2a\u5b57\u7b26\u548c\u4ece\u7d22\u5f15<code>-n<\/code>\u5f00\u59cb\u7684\u5b57\u7b26\u6765\u53bb\u6389\u5012\u6570\u7b2cn\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<h2><strong>\u516d\u3001\u4f7f\u7528\u5217\u8868\u8f6c\u6362<\/strong><\/h2>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u7136\u540e\u4f7f\u7528\u5217\u8868\u7684\u64cd\u4f5c\u6765\u53bb\u6389\u5b57\u7b26\uff0c\u6700\u540e\u518d\u5c06\u5217\u8868\u8f6c\u6362\u56de\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>6.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u53bb\u6389\u7279\u5b9a\u5b57\u7b26\u540e\u518d\u5c06\u5217\u8868\u8f6c\u6362\u56de\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>str_list = list(str)<\/p>\n<p>str_list = [char for char in str_list if char != char_to_remove]<\/p>\n<p>new_str = &quot;&quot;.join(str_list)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u53bb\u6389\u5b57\u7b26<code>l<\/code>\uff0c\u7136\u540e\u5c06\u5217\u8868\u8f6c\u6362\u56de\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>6.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\u540e\u518d\u5c06\u5217\u8868\u8f6c\u6362\u56de\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>str_list = list(str)<\/p>\n<p>str_list = [char for char in str_list if char not in chars_to_remove]<\/p>\n<p>new_str = &quot;&quot;.join(str_list)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u53bb\u6389\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\uff0c\u7136\u540e\u5c06\u5217\u8868\u8f6c\u6362\u56de\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<h2><strong>\u4e03\u3001\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f<\/strong><\/h2>\n<p><p>\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u7b80\u6d01\u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u7528\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>7.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = &quot;&quot;.join(char for char in str if char != char_to_remove)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u751f\u6210\u4e0d\u5305\u542b\u5b57\u7b26<code>l<\/code>\u7684\u5b57\u7b26\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u62fc\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>7.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>new_str = &quot;&quot;.join(char for char in str if char not in chars_to_remove)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u751f\u6210\u4e0d\u5305\u542b\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\u7684\u5b57\u7b26\uff0c\u7136\u540e\u5c06\u5b83\u4eec\u62fc\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<h2><strong>\u516b\u3001\u4f7f\u7528filter()\u51fd\u6570<\/strong><\/h2>\n<p><p><code>filter()<\/code>\u51fd\u6570\u53ef\u4ee5\u7528\u6765\u8fc7\u6ee4\u6389\u4e0d\u9700\u8981\u7684\u5b57\u7b26\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u4e0e<code>lambda<\/code>\u8868\u8fbe\u5f0f\u7ed3\u5408\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><h2>8.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>filter()<\/code>\u51fd\u6570\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = &quot;&quot;.join(filter(lambda char: char != char_to_remove, str))<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>filter()<\/code>\u51fd\u6570\u8fc7\u6ee4\u6389\u5b57\u7b26<code>l<\/code>\uff0c\u7136\u540e\u5c06\u7ed3\u679c\u62fc\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>8.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<code>filter()<\/code>\u51fd\u6570\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>new_str = &quot;&quot;.join(filter(lambda char: char not in chars_to_remove, str))<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>filter()<\/code>\u51fd\u6570\u8fc7\u6ee4\u6389\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\uff0c\u7136\u540e\u5c06\u7ed3\u679c\u62fc\u63a5\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<h2><strong>\u4e5d\u3001\u4f7f\u7528\u9012\u5f52<\/strong><\/h2>\n<p><p>\u9012\u5f52\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u7f16\u7a0b\u6280\u5de7\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u5b83\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>9.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u9012\u5f52\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def remove_char_recursive(s, char_to_remove):<\/p>\n<p>    if not s:<\/p>\n<p>        return &quot;&quot;<\/p>\n<p>    if s[0] == char_to_remove:<\/p>\n<p>        return remove_char_recursive(s[1:], char_to_remove)<\/p>\n<p>    else:<\/p>\n<p>        return s[0] + remove_char_recursive(s[1:], char_to_remove)<\/p>\n<p>str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = remove_char_recursive(str, char_to_remove)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u9012\u5f52\u51fd\u6570<code>remove_char_recursive()<\/code>\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26<code>l<\/code>\u3002<\/p>\n<\/p>\n<p><h2>9.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u9012\u5f52\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def remove_chars_recursive(s, chars_to_remove):<\/p>\n<p>    if not s:<\/p>\n<p>        return &quot;&quot;<\/p>\n<p>    if s[0] in chars_to_remove:<\/p>\n<p>        return remove_chars_recursive(s[1:], chars_to_remove)<\/p>\n<p>    else:<\/p>\n<p>        return s[0] + remove_chars_recursive(s[1:], chars_to_remove)<\/p>\n<p>str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>new_str = remove_chars_recursive(str, chars_to_remove)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u9012\u5f52\u51fd\u6570<code>remove_chars_recursive()<\/code>\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\u3002<\/p>\n<\/p>\n<h2><strong>\u5341\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u66ff\u6362<\/strong><\/h2>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684\u66ff\u6362\u65b9\u6cd5\u6765\u53bb\u6389\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>10.1 \u53bb\u6389\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>replace()<\/code>\u65b9\u6cd5\u6765\u53bb\u6389\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>char_to_remove = &quot;l&quot;<\/p>\n<p>new_str = str.replace(char_to_remove, &quot;&quot;)<\/p>\n<p>print(new_str)  # Heo, Word!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>str.replace(char_to_remove, &quot;&quot;)<\/code>\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26<code>l<\/code>\u3002<\/p>\n<\/p>\n<p><h2>10.2 \u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26<\/h2>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>replace()<\/code>\u65b9\u6cd5\u6765\u53bb\u6389\u591a\u4e2a\u7279\u5b9a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str = &quot;Hello, World!&quot;<\/p>\n<p>chars_to_remove = &quot;lo&quot;<\/p>\n<p>new_str = str<\/p>\n<p>for char in chars_to_remove:<\/p>\n<p>    new_str = new_str.replace(char, &quot;&quot;)<\/p>\n<p>print(new_str)  # He, Wrld!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u5faa\u73af\u548c<code>replace()<\/code>\u65b9\u6cd5\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26<code>l<\/code>\u548c<code>o<\/code>\u3002<\/p>\n<\/p>\n<h2><strong>\u603b\u7ed3<\/strong><\/h2>\n<p><p>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u53bb\u6389\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\u5207\u7247\u3001<code>replace()<\/code>\u65b9\u6cd5\u3001<code>re<\/code>\u6a21\u5757\u3001<code>str.translate()<\/code>\u65b9\u6cd5\u3001\u5b57\u7b26\u4e32\u62fc\u63a5\u3001\u5217\u8868\u8f6c\u6362\u3001\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u3001<code>filter()<\/code>\u51fd\u6570\u3001\u9012\u5f52\u548c\u5b57\u7b26\u4e32\u66ff\u6362\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u72ec\u7279\u7684\u4f18\u70b9\u548c\u9002\u7528\u573a\u666f\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u5904\u7406\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5220\u9664\u5b57\u7b26\u4e32\u7684\u7279\u5b9a\u5b57\u7b26\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>replace()<\/code>\u65b9\u6cd5\u6765\u5220\u9664\u7279\u5b9a\u5b57\u7b26\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60f3\u8981\u5220\u9664\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u6bcd&#39;a&#39;\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">original_string = &quot;Hello, a world!&quot;\nmodified_string = original_string.replace(&quot;a&quot;, &quot;&quot;)\nprint(modified_string)  # \u8f93\u51fa: Hello,  world!\n<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u4f7f\u7528<code>str.translate()<\/code>\u548c<code>str.maketrans()<\/code>\u7ec4\u5408\u4e5f\u53ef\u4ee5\u9ad8\u6548\u5730\u5220\u9664\u591a\u4e2a\u5b57\u7b26\u3002<\/p>\n<p><strong>Python\u4e2d\u6709\u54ea\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u53bb\u6389\u5b57\u7b26\u4e32\u7684\u524d\u540e\u7a7a\u683c\u548c\u7279\u5b9a\u5b57\u7b26\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>strip()<\/code>\u65b9\u6cd5\u53bb\u6389\u5b57\u7b26\u4e32\u4e24\u7aef\u7684\u7a7a\u683c\uff0c\u4f7f\u7528<code>lstrip()<\/code>\u548c<code>rstrip()<\/code>\u5206\u522b\u53bb\u6389\u5de6\u4fa7\u548c\u53f3\u4fa7\u7684\u7a7a\u683c\u3002\u5982\u679c\u9700\u8981\u53bb\u6389\u7279\u5b9a\u5b57\u7b26\uff0c\u53ef\u4ee5\u4f20\u5165\u5b57\u7b26\u4f5c\u4e3a\u53c2\u6570\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">string = &quot;!!!Hello, World!!!&quot;\ncleaned_string = string.strip(&quot;!&quot;)\nprint(cleaned_string)  # \u8f93\u51fa: Hello, World\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u7075\u6d3b\u9002\u7528\u4e8e\u591a\u79cd\u573a\u666f\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u53bb\u6389\u7279\u5b9a\u5b57\u7b26\uff1f<\/strong><br \/>\u4f7f\u7528<code>re<\/code>\u6a21\u5757\u53ef\u4ee5\u901a\u8fc7\u6b63\u5219\u8868\u8fbe\u5f0f\u5220\u9664\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60f3\u8981\u53bb\u6389\u6240\u6709\u6570\u5b57\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">import re\n\noriginal_string = &quot;Hello123, World456!&quot;\nmodified_string = re.sub(r&#39;\\d+&#39;, &#39;&#39;, original_string)\nprint(modified_string)  # \u8f93\u51fa: Hello, World!\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u5728\u9700\u8981\u5904\u7406\u590d\u6742\u5b57\u7b26\u6a21\u5f0f\u65f6\u7279\u522b\u6709\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u53bb\u6389\u51e0\u4e2a\u5b57\u7b26\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247\u3001replace()\u65b9\u6cd5\u3001re\u6a21\u5757\u3001str.translate [&hellip;]","protected":false},"author":3,"featured_media":1076944,"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\/1076939"}],"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=1076939"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1076939\/revisions"}],"predecessor-version":[{"id":1076946,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1076939\/revisions\/1076946"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1076944"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1076939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1076939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1076939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}