{"id":1055153,"date":"2024-12-31T14:48:16","date_gmt":"2024-12-31T06:48:16","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1055153.html"},"modified":"2024-12-31T14:48:18","modified_gmt":"2024-12-31T06:48:18","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8python%e4%b8%ad%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%8b%bc%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1055153.html","title":{"rendered":"\u5982\u4f55\u5728python\u4e2d\u5b57\u7b26\u4e32\u62fc\u63a5"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/7b0b21ab-4ebe-44d0-b792-aa71e067cb49.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u5728python\u4e2d\u5b57\u7b26\u4e32\u62fc\u63a5\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u62fc\u63a5\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b8c\u6210\uff0c\u5982\u4f7f\u7528\u52a0\u53f7\uff08+\uff09\u64cd\u4f5c\u7b26\u3001\u4f7f\u7528join()\u65b9\u6cd5\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09\u3001\u4f7f\u7528%\u64cd\u4f5c\u7b26\u3001\u4ee5\u53ca\u4f7f\u7528str.format()\u65b9\u6cd5\u7b49<\/strong>\u3002\u5176\u4e2d\uff0c\u6700\u5e38\u7528\u548c\u63a8\u8350\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u548c\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09\u3002\u7279\u522b\u662f<strong>f-strings<\/strong>\uff0c\u5b83\u5728Python 3.6\u53ca\u4ee5\u4e0a\u7248\u672c\u4e2d\u88ab\u5e7f\u6cdb\u4f7f\u7528\uff0c\u56e0\u5176\u7b80\u6d01\u9ad8\u6548\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u63cf\u8ff0\u4e00\u4e9b\u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e00\u3001\u4f7f\u7528\u52a0\u53f7\uff08+\uff09\u64cd\u4f5c\u7b26<\/strong><\/p>\n<\/p>\n<p><p>\u52a0\u53f7\u64cd\u4f5c\u7b26\u662f\u6700\u76f4\u89c2\u548c\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\u3002\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u662f\u4e0d\u53ef\u53d8\u7684\uff0c\u8fd9\u610f\u5473\u7740\u6bcf\u6b21\u62fc\u63a5\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u5bf9\u8c61\u3002\u8fd9\u79cd\u65b9\u6cd5\u867d\u7136\u6613\u4e8e\u7406\u89e3\uff0c\u4f46\u5728\u5904\u7406\u5927\u91cf\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\u53ef\u80fd\u4f1a\u5f71\u54cd\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str1 = &quot;Hello&quot;<\/p>\n<p>str2 = &quot;World&quot;<\/p>\n<p>result = str1 + &quot; &quot; + str2<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aHello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e8c\u3001\u4f7f\u7528join()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>join()\u65b9\u6cd5\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u5408\u5728\u9700\u8981\u62fc\u63a5\u591a\u4e2a\u5b57\u7b26\u4e32\u65f6\u4f7f\u7528\u3002\u5b83\u901a\u8fc7\u5728\u6bcf\u4e2a\u5b57\u7b26\u4e32\u4e4b\u95f4\u63d2\u5165\u4e00\u4e2a\u5206\u9694\u7b26\u6765\u8fde\u63a5\u5b57\u7b26\u4e32\u5217\u8868\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str_list = [&quot;Hello&quot;, &quot;World&quot;]<\/p>\n<p>result = &quot; &quot;.join(str_list)<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aHello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e09\u3001\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09\u662fPython 3.6\u5f15\u5165\u7684\u4e00\u79cd\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5728\u5b57\u7b26\u4e32\u524d\u52a0\u4e0a\u5b57\u6bcdf\uff0c\u5e76\u5728\u5b57\u7b26\u4e32\u4e2d\u4f7f\u7528\u5927\u62ec\u53f7{}\u5d4c\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5\u3002f-strings\u4e0d\u4ec5\u7b80\u6d01\u660e\u4e86\uff0c\u800c\u4e14\u6027\u80fd\u4f18\u8d8a\uff0c\u63a8\u8350\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str1 = &quot;Hello&quot;<\/p>\n<p>str2 = &quot;World&quot;<\/p>\n<p>result = f&quot;{str1} {str2}&quot;<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aHello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u56db\u3001\u4f7f\u7528%\u64cd\u4f5c\u7b26<\/strong><\/p>\n<\/p>\n<p><p>%\u64cd\u4f5c\u7b26\u662fPython\u4e2d\u4e00\u79cd\u8f83\u8001\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\uff0c\u7c7b\u4f3c\u4e8eC\u8bed\u8a00\u4e2d\u7684printf\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u5728Python 3.x\u4e2d\u4ecd\u7136\u53ef\u7528\uff0c\u4f46\u5b83\u5df2\u4e0d\u518d\u63a8\u8350\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4e0d\u5982\u5176\u4ed6\u65b9\u6cd5\u76f4\u89c2\u548c\u7075\u6d3b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str1 = &quot;Hello&quot;<\/p>\n<p>str2 = &quot;World&quot;<\/p>\n<p>result = &quot;%s %s&quot; % (str1, str2)<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aHello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e94\u3001\u4f7f\u7528str.format()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>str.format()\u65b9\u6cd5\u662fPython 2.7\u548c3.0\u5f15\u5165\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5728\u5b57\u7b26\u4e32\u4e2d\u4f7f\u7528\u5927\u62ec\u53f7{}\u8868\u793a\u5360\u4f4d\u7b26\uff0c\u5e76\u8c03\u7528format()\u65b9\u6cd5\u4f20\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str1 = &quot;Hello&quot;<\/p>\n<p>str2 = &quot;World&quot;<\/p>\n<p>result = &quot;{} {}&quot;.format(str1, str2)<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aHello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e00\u3001\u4f7f\u7528\u52a0\u53f7\uff08+\uff09\u64cd\u4f5c\u7b26<\/strong><\/p>\n<\/p>\n<p><p>\u52a0\u53f7\u64cd\u4f5c\u7b26\u662fPython\u4e2d\u6700\u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\u4e4b\u4e00\u3002\u5b83\u7b80\u5355\u76f4\u89c2\uff0c\u975e\u5e38\u9002\u5408\u62fc\u63a5\u5c11\u91cf\u5b57\u7b26\u4e32\u3002\u6bcf\u6b21\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u8fdb\u884c\u62fc\u63a5\u65f6\uff0cPython\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u5bf9\u8c61\uff0c\u56e0\u6b64\u5728\u5904\u7406\u5927\u91cf\u5b57\u7b26\u4e32\u65f6\u6548\u7387\u8f83\u4f4e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">str1 = &quot;Python&quot;<\/p>\n<p>str2 = &quot;is&quot;<\/p>\n<p>str3 = &quot;awesome&quot;<\/p>\n<p>result = str1 + &quot; &quot; + str2 + &quot; &quot; + str3<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aPython is awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u4e09\u4e2a\u5b57\u7b26\u4e32\u901a\u8fc7\u52a0\u53f7\u64cd\u4f5c\u7b26\u62fc\u63a5\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u53e5\u5b50\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u7b80\u5355\u6613\u7528\uff0c\u4f46\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u5728\u5faa\u73af\u4e2d\u9891\u7e41\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u8fdb\u884c\u5b57\u7b26\u4e32\u62fc\u63a5\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6027\u80fd\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">words = [&quot;Python&quot;, &quot;is&quot;, &quot;awesome&quot;]<\/p>\n<p>sentence = &quot;&quot;<\/p>\n<p>for word in words:<\/p>\n<p>    sentence += word + &quot; &quot;<\/p>\n<p>print(sentence.strip())  # \u8f93\u51fa\uff1aPython is awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u5c55\u793a\u4e86\u5728\u5faa\u73af\u4e2d\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u62fc\u63a5\u5b57\u7b26\u4e32\u3002\u7531\u4e8e\u6bcf\u6b21\u62fc\u63a5\u90fd\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u5bf9\u8c61\uff0c\u56e0\u6b64\u8fd9\u79cd\u65b9\u6cd5\u5728\u5927\u91cf\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\u7684\u6027\u80fd\u8f83\u4f4e\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e8c\u3001\u4f7f\u7528join()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>join()\u65b9\u6cd5\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u5408\u5728\u9700\u8981\u62fc\u63a5\u5927\u91cf\u5b57\u7b26\u4e32\u65f6\u4f7f\u7528\u3002\u5b83\u901a\u8fc7\u5728\u6bcf\u4e2a\u5b57\u7b26\u4e32\u4e4b\u95f4\u63d2\u5165\u4e00\u4e2a\u5206\u9694\u7b26\u6765\u8fde\u63a5\u5b57\u7b26\u4e32\u5217\u8868\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">words = [&quot;Python&quot;, &quot;is&quot;, &quot;awesome&quot;]<\/p>\n<p>sentence = &quot; &quot;.join(words)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aPython is awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7join()\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u5217\u8868\u62fc\u63a5\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u53e5\u5b50\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u9ad8\u6548\uff0c\u800c\u4e14\u4ee3\u7801\u7b80\u6d01\u6e05\u6670\u3002<\/p>\n<\/p>\n<p><p>join()\u65b9\u6cd5\u7684\u53e6\u4e00\u4e2a\u4f18\u70b9\u662f\u53ef\u4ee5\u7075\u6d3b\u5730\u6307\u5b9a\u5206\u9694\u7b26\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">words = [&quot;Python&quot;, &quot;is&quot;, &quot;awesome&quot;]<\/p>\n<p>comma_separated = &quot;, &quot;.join(words)<\/p>\n<p>print(comma_separated)  # \u8f93\u51fa\uff1aPython, is, awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u9017\u53f7\u548c\u7a7a\u683c\u4f5c\u4e3a\u5206\u9694\u7b26\uff0c\u62fc\u63a5\u5b57\u7b26\u4e32\u5217\u8868\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e09\u3001\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09\u662fPython 3.6\u5f15\u5165\u7684\u4e00\u79cd\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\uff0c\u901a\u8fc7\u5728\u5b57\u7b26\u4e32\u524d\u52a0\u4e0a\u5b57\u6bcdf\uff0c\u5e76\u5728\u5b57\u7b26\u4e32\u4e2d\u4f7f\u7528\u5927\u62ec\u53f7{}\u5d4c\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5\u3002f-strings\u4e0d\u4ec5\u7b80\u6d01\u660e\u4e86\uff0c\u800c\u4e14\u6027\u80fd\u4f18\u8d8a\uff0c\u63a8\u8350\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;John&quot;<\/p>\n<p>age = 30<\/p>\n<p>sentence = f&quot;My name is {name} and I am {age} years old.&quot;<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528f-strings\u5c06\u53d8\u91cfname\u548cage\u5d4c\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002f-strings\u652f\u6301\u5d4c\u5165\u4efb\u610f\u8868\u8fbe\u5f0f\uff0c\u8fd9\u4f7f\u5f97\u5b83\u975e\u5e38\u7075\u6d3b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">a = 5<\/p>\n<p>b = 10<\/p>\n<p>result = f&quot;The sum of {a} and {b} is {a + b}.&quot;<\/p>\n<p>print(result)  # \u8f93\u51fa\uff1aThe sum of 5 and 10 is 15.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5728f-strings\u4e2d\u5d4c\u5165\u4e86\u4e00\u4e2a\u8868\u8fbe\u5f0f{a + b}\uff0c\u5e76\u5c06\u5176\u7ed3\u679c\u63d2\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002<\/p>\n<\/p>\n<p><p><strong>\u56db\u3001\u4f7f\u7528%\u64cd\u4f5c\u7b26<\/strong><\/p>\n<\/p>\n<p><p>%\u64cd\u4f5c\u7b26\u662f\u4e00\u79cd\u8f83\u8001\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\uff0c\u7c7b\u4f3c\u4e8eC\u8bed\u8a00\u4e2d\u7684printf\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u5728Python 3.x\u4e2d\u4ecd\u7136\u53ef\u7528\uff0c\u4f46\u5b83\u5df2\u4e0d\u518d\u63a8\u8350\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4e0d\u5982\u5176\u4ed6\u65b9\u6cd5\u76f4\u89c2\u548c\u7075\u6d3b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;John&quot;<\/p>\n<p>age = 30<\/p>\n<p>sentence = &quot;My name is %s and I am %d years old.&quot; % (name, age)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528%\u64cd\u4f5c\u7b26\u5c06\u53d8\u91cfname\u548cage\u63d2\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002%\u64cd\u4f5c\u7b26\u652f\u6301\u591a\u79cd\u683c\u5f0f\u8bf4\u660e\u7b26\uff0c\u4f8b\u5982%s\u8868\u793a\u5b57\u7b26\u4e32\uff0c%d\u8868\u793a\u6574\u6570\uff0c%f\u8868\u793a\u6d6e\u70b9\u6570\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">pi = 3.141592653589793<\/p>\n<p>sentence = &quot;The value of pi is approximately %.2f.&quot; % pi<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aThe value of pi is approximately 3.14.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528%.2f\u683c\u5f0f\u8bf4\u660e\u7b26\u5c06\u6d6e\u70b9\u6570pi\u683c\u5f0f\u5316\u4e3a\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e94\u3001\u4f7f\u7528str.format()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>str.format()\u65b9\u6cd5\u662fPython 2.7\u548c3.0\u5f15\u5165\u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5728\u5b57\u7b26\u4e32\u4e2d\u4f7f\u7528\u5927\u62ec\u53f7{}\u8868\u793a\u5360\u4f4d\u7b26\uff0c\u5e76\u8c03\u7528format()\u65b9\u6cd5\u4f20\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;John&quot;<\/p>\n<p>age = 30<\/p>\n<p>sentence = &quot;My name is {} and I am {} years old.&quot;.format(name, age)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528str.format()\u65b9\u6cd5\u5c06\u53d8\u91cfname\u548cage\u63d2\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002str.format()\u65b9\u6cd5\u652f\u6301\u4f4d\u7f6e\u53c2\u6570\u548c\u5173\u952e\u5b57\u53c2\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;John&quot;<\/p>\n<p>age = 30<\/p>\n<p>sentence = &quot;My name is {0} and I am {1} years old.&quot;.format(name, age)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p>sentence = &quot;My name is {name} and I am {age} years old.&quot;.format(name=&quot;John&quot;, age=30)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c55\u793a\u4e86\u4f7f\u7528\u4f4d\u7f6e\u53c2\u6570\u548c\u5173\u952e\u5b57\u53c2\u6570\u7684str.format()\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p><strong>\u516d\u3001\u4f7f\u7528\u6a21\u677f\u5b57\u7b26\u4e32\uff08Template Strings\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u6a21\u677f\u5b57\u7b26\u4e32\uff08Template Strings\uff09\u662fPython\u6807\u51c6\u5e93\u4e2d\u7684string\u6a21\u5757\u63d0\u4f9b\u7684\u4e00\u79cd\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\u3002\u5b83\u901a\u8fc7\u5b9a\u4e49\u6a21\u677f\u5b57\u7b26\u4e32\uff0c\u5e76\u4f7f\u7528$\u7b26\u53f7\u8868\u793a\u5360\u4f4d\u7b26\uff0c\u8c03\u7528substitute()\u65b9\u6cd5\u6216<a href=\"https:\/\/docs.pingcode.com\/agile\/agile-at-scale\/what-is-safe\" target=\"_blank\">SAFe<\/a>_substitute()\u65b9\u6cd5\u4f20\u5165\u5b57\u5178\u6216\u5173\u952e\u5b57\u53c2\u6570\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u62fc\u63a5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from string import Template<\/p>\n<p>template = Template(&quot;My name is $name and I am $age years old.&quot;)<\/p>\n<p>sentence = template.substitute(name=&quot;John&quot;, age=30)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u6a21\u677f\u5b57\u7b26\u4e32\u548csubstitute()\u65b9\u6cd5\u5c06\u53d8\u91cfname\u548cage\u63d2\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002\u6a21\u677f\u5b57\u7b26\u4e32\u652f\u6301\u901a\u8fc7\u5b57\u5178\u4f20\u5165\u53d8\u91cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from string import Template<\/p>\n<p>template = Template(&quot;My name is $name and I am $age years old.&quot;)<\/p>\n<p>data = {&quot;name&quot;: &quot;John&quot;, &quot;age&quot;: 30}<\/p>\n<p>sentence = template.substitute(data)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u53d8\u91cfname\u548cage\u5b58\u50a8\u5728\u5b57\u5178\u4e2d\uff0c\u5e76\u901a\u8fc7substitute()\u65b9\u6cd5\u5c06\u5176\u63d2\u5165\u5230\u6a21\u677f\u5b57\u7b26\u4e32\u4e2d\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e03\u3001\u4f7f\u7528\u5185\u7f6e\u51fd\u6570str()<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u5c06\u975e\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u53d8\u91cf\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u5c06\u5176\u62fc\u63a5\u5230\u5b57\u7b26\u4e32\u4e2d\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u51fd\u6570str()\u6765\u5b8c\u6210\u8fd9\u79cd\u8f6c\u6362\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">num = 123<\/p>\n<p>sentence = &quot;The number is &quot; + str(num) + &quot;.&quot;<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aThe number is 123.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528str()\u51fd\u6570\u5c06\u6574\u6570num\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u5c06\u5176\u62fc\u63a5\u5230\u53e5\u5b50\u4e2d\u3002<\/p>\n<\/p>\n<p><p><strong>\u516b\u3001\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u548cjoin()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u91cf\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u548cjoin()\u65b9\u6cd5\uff0c\u4ee5\u83b7\u5f97\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u7b80\u6d01\u7684\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">words = [&quot;Python&quot;, &quot;is&quot;, &quot;awesome&quot;]<\/p>\n<p>sentence = &quot; &quot;.join([word for word in words])<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aPython is awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u751f\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u5217\u8868\uff0c\u5e76\u901a\u8fc7join()\u65b9\u6cd5\u5c06\u5176\u62fc\u63a5\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u53e5\u5b50\u3002<\/p>\n<\/p>\n<p><p><strong>\u4e5d\u3001\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u548cjoin()\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u8fed\u4ee3\u5668\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u5728\u4e0d\u521b\u5efa\u5b8c\u6574\u5217\u8868\u7684\u60c5\u51b5\u4e0b\u751f\u6210\u503c\u5e8f\u5217\u3002\u7ed3\u5408\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u548cjoin()\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u5904\u7406\u5927\u91cf\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\u8282\u7701\u5185\u5b58\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">words = [&quot;Python&quot;, &quot;is&quot;, &quot;awesome&quot;]<\/p>\n<p>sentence = &quot; &quot;.join(word for word in words)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aPython is awesome<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u751f\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u5e8f\u5217\uff0c\u5e76\u901a\u8fc7join()\u65b9\u6cd5\u5c06\u5176\u62fc\u63a5\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u53e5\u5b50\u3002<\/p>\n<\/p>\n<p><p><strong>\u5341\u3001\u4f7f\u7528\u591a\u884c\u5b57\u7b26\u4e32<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u62fc\u63a5\u5305\u542b\u6362\u884c\u7b26\u7684\u591a\u884c\u5b57\u7b26\u4e32\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e09\u5f15\u53f7\uff08&#39;&#39;&#39;\u6216&quot;&quot;&quot;\uff09\u5b9a\u4e49\u591a\u884c\u5b57\u7b26\u4e32\uff0c\u5e76\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u6216\u5176\u4ed6\u62fc\u63a5\u65b9\u6cd5\u5c06\u5176\u7ec4\u5408\u5728\u4e00\u8d77\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">line1 = &quot;This is line 1.&quot;<\/p>\n<p>line2 = &quot;This is line 2.&quot;<\/p>\n<p>line3 = &quot;This is line 3.&quot;<\/p>\n<p>multiline_string = line1 + &quot;\\n&quot; + line2 + &quot;\\n&quot; + line3<\/p>\n<p>print(multiline_string)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u548c\u6362\u884c\u7b26\uff08\\n\uff09\u62fc\u63a5\u591a\u884c\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><p>\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u4e09\u5f15\u53f7\u5b9a\u4e49\u591a\u884c\u5b57\u7b26\u4e32\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">multiline_string = &quot;&quot;&quot;This is line 1.<\/p>\n<p>This is line 2.<\/p>\n<p>This is line 3.&quot;&quot;&quot;<\/p>\n<p>print(multiline_string)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e09\u5f15\u53f7\u76f4\u63a5\u5b9a\u4e49\u4e86\u4e00\u4e2a\u5305\u542b\u6362\u884c\u7b26\u7684\u591a\u884c\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><p><strong>\u5341\u4e00\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u8fde\u63a5\u7b26\uff08concatenation operator\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u8fde\u63a5\u7b26\uff08\u5982\u53cd\u659c\u6760\\\uff09\u5c06\u957f\u5b57\u7b26\u4e32\u5206\u6210\u591a\u884c\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">long_string = &quot;This is a very long string that we want to split &quot; \\<\/p>\n<p>              &quot;into multiple lines for better readability.&quot;<\/p>\n<p>print(long_string)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u53cd\u659c\u6760\u5c06\u957f\u5b57\u7b26\u4e32\u5206\u6210\u591a\u884c\uff0c\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<p><p><strong>\u5341\u4e8c\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u63d2\u503c\uff08String Interpolation\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u5b57\u7b26\u4e32\u63d2\u503c\uff08String Interpolation\uff09\u662f\u4e00\u79cd\u5728\u5b57\u7b26\u4e32\u4e2d\u5d4c\u5165\u53d8\u91cf\u6216\u8868\u8fbe\u5f0f\u7684\u6280\u672f\u3002\u5728Python\u4e2d\uff0cf-strings\u548cstr.format()\u65b9\u6cd5\u90fd\u652f\u6301\u5b57\u7b26\u4e32\u63d2\u503c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;John&quot;<\/p>\n<p>age = 30<\/p>\n<p>sentence = f&quot;My name is {name} and I am {age} years old.&quot;<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p>sentence = &quot;My name is {} and I am {} years old.&quot;.format(name, age)<\/p>\n<p>print(sentence)  # \u8f93\u51fa\uff1aMy name is John and I am 30 years old.<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528f-strings\u548cstr.format()\u65b9\u6cd5\u8fdb\u884c\u5b57\u7b26\u4e32\u63d2\u503c\uff0c\u5c06\u53d8\u91cfname\u548cage\u5d4c\u5165\u5230\u5b57\u7b26\u4e32\u4e2d\u3002<\/p>\n<\/p>\n<p><p>\u603b\u7ed3\uff1a<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u62fc\u63a5\u6709\u591a\u79cd\u65b9\u6cd5\u53ef\u4f9b\u9009\u62e9\uff0c\u5305\u62ec\u4f7f\u7528\u52a0\u53f7\u64cd\u4f5c\u7b26\u3001join()\u65b9\u6cd5\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-strings\uff09\u3001%\u64cd\u4f5c\u7b26\u3001str.format()\u65b9\u6cd5\u3001\u6a21\u677f\u5b57\u7b26\u4e32\u3001\u5185\u7f6e\u51fd\u6570str()\u3001\u5217\u8868\u63a8\u5bfc\u5f0f\u3001\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u3001\u591a\u884c\u5b57\u7b26\u4e32\u3001\u5b57\u7b26\u4e32\u8fde\u63a5\u7b26\u548c\u5b57\u7b26\u4e32\u63d2\u503c\u7b49\u3002\u6839\u636e\u5177\u4f53\u7684\u9700\u6c42\u548c\u573a\u666f\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u6027\u80fd\u3002\u5728\u5904\u7406\u5927\u91cf\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\uff0c\u63a8\u8350\u4f7f\u7528join()\u65b9\u6cd5\u3001f-strings\u6216str.format()\u65b9\u6cd5\uff0c\u4ee5\u83b7\u5f97\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u7b80\u6d01\u7684\u4ee3\u7801\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\u6709\u54ea\u4e9b\u5e38\u89c1\u7684\u5b57\u7b26\u4e32\u62fc\u63a5\u65b9\u6cd5\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u8fdb\u884c\u5b57\u7b26\u4e32\u62fc\u63a5\u3002\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u52a0\u53f7\u8fd0\u7b97\u7b26\uff08+\uff09\u3001\u4f7f\u7528join()\u65b9\u6cd5\u3001\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08f-string\uff09\u3001\u4ee5\u53ca\u4f7f\u7528\u767e\u5206\u53f7\uff08%\uff09\u683c\u5f0f\u5316\u3002\u52a0\u53f7\u8fd0\u7b97\u7b26\u7b80\u5355\u76f4\u89c2\uff0c\u4f46\u5728\u62fc\u63a5\u5927\u91cf\u5b57\u7b26\u4e32\u65f6\u53ef\u80fd\u4f1a\u5f71\u54cd\u6027\u80fd\u3002join()\u65b9\u6cd5\u5219\u9002\u5408\u62fc\u63a5\u5217\u8868\u4e2d\u7684\u591a\u4e2a\u5b57\u7b26\u4e32\uff0c\u6548\u7387\u66f4\u9ad8\u3002\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u63d0\u4f9b\u4e86\u66f4\u7075\u6d3b\u7684\u65b9\u5f0f\u6765\u6784\u5efa\u5305\u542b\u53d8\u91cf\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\u6709\u54ea\u4e9b\u6027\u80fd\u8003\u8651\uff1f<\/strong><br \/>\u5728\u8fdb\u884c\u5b57\u7b26\u4e32\u62fc\u63a5\u65f6\uff0c\u6027\u80fd\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u8003\u8651\u56e0\u7d20\u3002\u4f7f\u7528\u52a0\u53f7\u8fd0\u7b97\u7b26\u5728\u591a\u6b21\u62fc\u63a5\u65f6\u4f1a\u751f\u6210\u591a\u4e2a\u4e2d\u95f4\u5b57\u7b26\u4e32\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u5360\u7528\u589e\u52a0\u548c\u901f\u5ea6\u53d8\u6162\u3002\u5bf9\u4e8e\u5927\u91cf\u5b57\u7b26\u4e32\u7684\u62fc\u63a5\uff0c\u63a8\u8350\u4f7f\u7528join()\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u53ea\u751f\u6210\u4e00\u4e2a\u6700\u7ec8\u5b57\u7b26\u4e32\uff0c\u6027\u80fd\u66f4\u4f73\u3002\u4e86\u89e3\u4e0d\u540c\u62fc\u63a5\u65b9\u6cd5\u7684\u6027\u80fd\u5dee\u5f02\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u9009\u62e9\u6700\u9002\u5408\u4f60\u7684\u5e94\u7528\u573a\u666f\u7684\u65b9\u5f0f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u5b57\u7b26\u4e32\u62fc\u63a5\u4e2d\u7684\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\uff1f<\/strong><br \/>\u5728\u5b57\u7b26\u4e32\u62fc\u63a5\u8fc7\u7a0b\u4e2d\uff0c\u5904\u7406\u7a7a\u683c\u548c\u7279\u6b8a\u5b57\u7b26\u5f88\u91cd\u8981\u3002\u53ef\u4ee5\u4f7f\u7528strip()\u65b9\u6cd5\u53bb\u9664\u5b57\u7b26\u4e32\u4e24\u7aef\u7684\u7a7a\u683c\uff0c\u786e\u4fdd\u62fc\u63a5\u540e\u7684\u5b57\u7b26\u4e32\u6574\u6d01\u3002\u5bf9\u4e8e\u7279\u6b8a\u5b57\u7b26\uff0c\u53ef\u4ee5\u4f7f\u7528replace()\u65b9\u6cd5\u8fdb\u884c\u66ff\u6362\uff0c\u6216\u8005\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26\u6765\u5904\u7406\u3002\u786e\u4fdd\u5728\u62fc\u63a5\u524d\u6e05\u7406\u548c\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff0c\u80fd\u6709\u6548\u907f\u514d\u62fc\u63a5\u540e\u51fa\u73b0\u4e0d\u5fc5\u8981\u7684\u7a7a\u683c\u6216\u683c\u5f0f\u9519\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u62fc\u63a5\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b8c\u6210\uff0c\u5982\u4f7f\u7528\u52a0\u53f7\uff08+\uff09\u64cd\u4f5c\u7b26\u3001\u4f7f\u7528join()\u65b9\u6cd5\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08 [&hellip;]","protected":false},"author":3,"featured_media":1055162,"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\/1055153"}],"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=1055153"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1055153\/revisions"}],"predecessor-version":[{"id":1055164,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1055153\/revisions\/1055164"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1055162"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1055153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1055153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1055153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}