﻿{"id":4163,"date":"2020-11-22T20:40:49","date_gmt":"2020-11-22T12:40:49","guid":{"rendered":"https:\/\/www.linuxmi.com\/?p=4163"},"modified":"2020-11-22T20:42:28","modified_gmt":"2020-11-22T12:42:28","slug":"python-split-string","status":"publish","type":"post","link":"https:\/\/www.linuxmi.com\/python-split-string.html","title":{"rendered":"\u5b66\u4e60Python\u5206\u5272\u5b57\u7b26\u4e32\u76845\u4e2a\u7b80\u5355\u793a\u4f8b"},"content":{"rendered":"<p>\u5728\u8fd9\u4e2aPython\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60Python split()\u5b57\u7b26\u4e32\u51fd\u6570\u3002\u4e0elen()\u4e0d\u540c\uff0c\u6709\u4e9b\u51fd\u6570\u662f\u7279\u5b9a\u4e8e\u5b57\u7b26\u4e32\u7684\u3002\u8981\u4f7f\u7528\u5b57\u7b26\u4e32\u51fd\u6570\uff0c\u8f93\u5165\u5b57\u7b26\u4e32\u7684\u540d\u79f0\u3001dot\u3001\u51fd\u6570\u7684\u540d\u79f0\u548c\u51fd\u6570\u9700\u8981\u7684<span style=\"box-sizing: inherit; color: #0a0a0a; font-family: -apple-system, system-ui, BlinkMacSystemFont, 'segoe ui', Helvetica, Arial, sans-serif, 'apple color emoji', 'segoe ui emoji', 'segoe ui symbol'; font-size: 15px; vertical-align: inherit;\"><span style=\"box-sizing: inherit; vertical-align: inherit;\">\u6240\u6709<\/span><\/span>\u53c2\u6570:string.function(arguments)\u3002\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684string split()\u51fd\u6570\u6839\u636e\u5206\u9694\u7b26\u5c06\u5b57\u7b26\u4e32\u5206\u89e3\u4e3a\u4e00\u7ec4\u66f4\u5c0f\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>Python string.split() \u8bed\u6cd5<\/strong><\/p>\n<p>\u4f7f\u7528string.split()\u7684\u8bed\u6cd5\u5982\u4e0b:<\/p>\n<p>string.split([separator[, maxsplit]])<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><strong>separator<\/strong> \u662f\u5206\u9694\u7b26\u5b57\u7b26\u4e32<\/li>\n<li>\u5982\u679c\u6307\u5b9a\u4e86maxsplit\uff0c\u5219\u6700\u591a\u5b8c\u6210maxsplit\u5206\u5272\uff08\u56e0\u6b64\uff0c\u5217\u8868\u6700\u591a\u5305\u542bmaxsplit + 1\u4e2a\u5143\u7d20\uff09<\/li>\n<li>\u5982\u679c\u6ca1\u6709\u6307\u5b9amaxsplit\u6216-1\uff0c\u90a3\u4e48\u62c6\u5206\u7684\u6570\u91cf\u5c31\u6ca1\u6709\u9650\u5236(\u6240\u6709\u53ef\u80fd\u7684\u62c6\u5206\u90fd\u8fdb\u884c\u4e86)\u3002<\/li>\n<li>\u5982\u679c<code>separator<\/code>\u6307\u5b9a\uff0c\u5219\u8fde\u7eed\u7684\u5206\u9694\u7b26\u4e0d\u4f1a\u5206\u7ec4\u5728\u4e00\u8d77\uff0c\u5e76\u88ab\u89c6\u4e3a\u5b9a\u754c\u7a7a\u5b57\u7b26\u4e32\uff08\u4f8b\u5982\uff0c<code>'1,,2'.split(',')<\/code>\u00a0\u8fd4\u56de\u00a0<code>['1', '', '2']<\/code>\uff09<\/li>\n<li>\u5982\u679c<code>separator<\/code>\u672a\u6307\u5b9a\u6216\u4e3aNone\uff0c\u5219\u8fde\u7eed\u7684<strong>\u7a7a\u767d<\/strong>\u884c\u5c06\u88ab\u89c6\u4e3a\u5355\u4e2a\u5206\u9694\u7b26\uff0c\u5e76\u4e14\u5982\u679c\u5b57\u7b26\u4e32\u5177\u6709\u524d\u5bfc\u6216\u5c3e\u968f\u7a7a\u683c\uff0c\u5219\u7ed3\u679c\u5728\u5f00\u5934\u6216\u7ed3\u5c3e\u5c06\u4e0d\u5305\u542b\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c<code>' 1 2 3 '.split()<\/code>\u8fd4\u56de<code>['1', '2', '3']<\/code><\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b1\uff1a\u4f7f\u7528\u7a7a\u683c\u5206\u5272\u5b57\u7b26\u4e32<\/strong><\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u811a\u672c\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u7a7a\u683c\u4f5c\u4e3a\u5206\u9694\u7b26\u5c06\u5305\u542b\u5b57\u7b26\u4e32\u7684\u53e5\u5b50\u5206\u5272\u6210\u591a\u4e2a\u5b50\u5b57\u7b26\u4e32\u3002\u5982\u679c\u6ca1\u6709\u8981\u5b9a\u4e49\u7684\u5206\u9694\u7b26\uff0c\u90a3\u4e48\u53ef\u4ee5\u53ea\u63d0\u4f9bsplit()\uff0c\u5b83\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5c06\u5206\u9694\u7b26\u89c6\u4e3aNone\u3002<\/p>\n<pre style=\"margin: 1.2em 0px; line-height: 1.2em; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em;\"><code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\"><span style=\"color: #999580;\">#!\/usr\/bin\/env python3<\/span>\r\n\r\nmystring = <span style=\"color: #60ac39;\">\"This is Python Tutorial linuxmi\"<\/span>\r\n\r\nprint(type(mystring)) <span style=\"color: #999580;\">## This will return type as string<\/span>\r\nnewstring = mystring.split() <span style=\"color: #999580;\">## split the string and store into newstring var<\/span>\r\nprint(newstring)  <span style=\"color: #999580;\">## print the content of newstring<\/span>\r\nprint(type(newstring))  <span style=\"color: #999580;\">## the new type would be list after splitting<\/span>\r\n<\/code><\/pre>\n<p>\u8be5\u811a\u672c\u7684\u8f93\u51fa\uff1a<\/p>\n<p>&lt;class &#8216;str&#8217;&gt;<br \/>\n[&#8216;This&#8217;, &#8216;is&#8217;, &#8216;Python&#8217;, &#8216;Tutorial&#8217;, &#8216;linuxmi&#8217;]<br \/>\n&lt;class &#8216;list&#8217;&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4165\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2020\/11\/split.png\" alt=\"\" width=\"1004\" height=\"682\" \/><\/p>\n<p><code>string.split()<\/code>\u5c06\u5728\u4f20\u9012\u7684\u53c2\u6570\u4e0a\u62c6\u5206\u548c\u5206\u5272\u5b57\u7b26\u4e32\uff0c\u5e76\u8fd4\u56de\u5217\u8868\u4e2d\u7684\u6240\u6709\u90e8\u5206\u3002\u8be5\u5217\u8868\u5c06\u4e0d\u5305\u62ec\u5206\u5272\u5b57\u7b26\u3002<\/p>\n<p><strong>\u793a\u4f8b2\uff1a\u4f7f\u7528\u9017\u53f7\u4f5c\u4e3a\u5206\u9694\u7b26<\/strong><\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9a\u4e49\u4e00\u4e2a\u5206\u9694\u7b26\u9017\u53f7( , )\uff0c\u5e76\u5c06\u5b57\u7b26\u4e32\u5206\u5272\u6210\u5217\u8868<\/p>\n<pre style=\"margin: 1.2em 0px; line-height: 1.2em; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em;\"><code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\"><span style=\"color: #999580;\">#!\/usr\/bin\/env python3<\/span>\r\n\r\nmystring = <span style=\"color: #60ac39;\">\"abc,def,linuxmi\"<\/span>\r\n\r\nprint(type(mystring)) <span style=\"color: #999580;\">## This will return type as string<\/span>\r\nnewstring = mystring.split(<span style=\"color: #60ac39;\">','<\/span>) <span style=\"color: #999580;\">## split the string using ',' and store into newstring var<\/span>\r\nprint(newstring)  <span style=\"color: #999580;\">## print the content of newstring<\/span>\r\nprint(type(newstring))  <span style=\"color: #999580;\">## the new type would be list after splitting<\/span>\r\n<\/code><\/pre>\n<p>\u8be5\u811a\u672c\u7684\u8f93\u51fa\uff1a<\/p>\n<p>&lt;class &#8216;str&#8217;&gt;<br \/>\n[&#8216;abc&#8217;, &#8216;def&#8217;, &#8216;linuxmi&#8217;]<br \/>\n&lt;class &#8216;list&#8217;&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4166\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2020\/11\/split-1.png\" alt=\"\" width=\"1004\" height=\"682\" \/><\/p>\n<p>\u6240\u4ee5\u8fd9\u6b21\u4f7f\u7528\u9017\u53f7\u5206\u9694\u8f93\u51fa\uff0c\u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u4e86string.split(\uff0c)\u3002\u7c7b\u4f3c\u5730\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u6765\u5206\u5272\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u793a\u4f8b3\uff1a<\/strong>\u5b9a\u4e49\u6700\u5927\u5206\u5272\u9650\u5236<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u60a8\u6ca1\u6709\u6307\u5b9a\u5206\u5272\u9650\u5236\uff0c\u90a3\u4e48\u6240\u6709\u53ef\u80fd\u7684\u503c\u5c06\u4ece\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4e2d\u5206\u5272\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06maxlimit\u5b9a\u4e49\u4e3a1\uff0c\u8fd9\u6837\u5728\u7b2c\u4e00\u6b21\u62c6\u5206\u4e4b\u540e\uff0cPython\u5c06\u5ffd\u7565\u5176\u4f59\u7684\u5206\u9694\u7b26\u3002<\/p>\n<pre style=\"margin: 1.2em 0px; line-height: 1.2em; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em;\"><code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\"><span style=\"color: #999580;\">#!\/usr\/bin\/env python3<\/span>\r\n\r\nmystring = <span style=\"color: #60ac39;\">\"abc,def,ghi,tre,linuxmi.com\"<\/span>\r\n\r\nprint(type(mystring)) <span style=\"color: #999580;\">## This will return type as string<\/span>\r\n\r\n<span style=\"color: #999580;\">## split the string using sep=',' with maxlimit=1 and store into newstring var<\/span>\r\nnewstring = mystring.split(<span style=\"color: #60ac39;\">','<\/span>,<span style=\"color: #b65611;\">1<\/span>)\r\n\r\nprint(newstring)  <span style=\"color: #999580;\">## print the content of newstring<\/span>\r\nprint(type(newstring))  <span style=\"color: #999580;\">## the new type would be list after splitting<\/span>\r\n<\/code><\/pre>\n<p>\u8be5\u811a\u672c\u7684\u8f93\u51fa\uff1a<\/p>\n<p>&lt;class &#8216;str&#8217;&gt;<br \/>\n[&#8216;abc&#8217;, &#8216;def,ghi,tre,linuxmi.com&#8217;]<br \/>\n&lt;class &#8216;list&#8217;&gt;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4167\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2020\/11\/maxlimit.png\" alt=\"\" width=\"1004\" height=\"682\" \/><\/p>\n<p>\u4ece\u8f93\u51fa\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u6211\u4eec\u7684\u5b57\u7b26\u4e32\u88ab\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u5728\u7b2c\u4e00\u4e2a\u5206\u9694\u7b26\u5339\u914d\u4e4b\u540e\uff0c\u6240\u6709\u5176\u4ed6\u9017\u53f7\u90fd\u5c06\u88ab\u5ffd\u7565\u3002<\/p>\n<p><strong>\u793a\u4f8b4\uff1a<\/strong>\u8ba1\u7b97\u6587\u4ef6\u4e2d\u5355\u8bcd\u7684\u51fa\u73b0\u6b21\u6570<\/p>\n<p>\u8be5split()\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u5728\u627e\u5230\u7a7a\u683c\u7684\u4efb\u4f55\u5730\u65b9\u5206\u6210\u51e0\u90e8\u5206\uff0c\u5e76\u5c06\u5b57\u7b26\u4e32\u7684\u6240\u6709\u90e8\u5206\u5b58\u50a8\u5728\u5217\u8868\u4e2d\u3002\u7ed3\u679c\u662f\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u5217\u8868\uff0c\u5c3d\u7ba1\u67d0\u4e9b\u5355\u8bcd\u53ef\u80fd\u8fd8\u4f1a\u51fa\u73b0\u6807\u70b9\u7b26\u53f7\u3002<\/p>\n<p>\u6211\u4eec\u5c06\u4f7f\u7528split()\u6765\u8ba1\u7b97\u201c\/usr\/share\/doc\/grep\/README\u201d\u6587\u4ef6\u4e2d\u7684\u5355\u8bcd\u6570\u91cf\u3002\u4f60\u53ef\u4ee5\u5ffd\u7565try\u548cexcept\u5757\uff0c\u5982\u679c\u4f60\u8fd8\u4e0d\u719f\u6089\u5b83\uff0c\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u6211\u6b63\u5728\u6267\u884c\u5b9e\u9645\u4efb\u52a1\u7684else\u5757\uff1a<\/p>\n<pre style=\"margin: 1.2em 0px; line-height: 1.2em; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em;\"><code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\"><span style=\"color: #999580;\">#!\/usr\/bin\/env python3<\/span>\r\nfilename = <span style=\"color: #60ac39;\">'\/usr\/share\/doc\/grep\/README'<\/span>\r\n\r\n<span style=\"color: #b854d4;\">try<\/span>:\r\n    <span style=\"color: #b854d4;\">with<\/span> open(filename, encoding=<span style=\"color: #60ac39;\">'utf-8'<\/span>) <span style=\"color: #b854d4;\">as<\/span> f:\r\n        contents= f.read()\r\n<span style=\"color: #b854d4;\">except<\/span> FileNotFoundError:\r\n    print(f<span style=\"color: #60ac39;\">'Sorry, the file {filename} does not exits'<\/span>)\r\n<span style=\"color: #b854d4;\">else<\/span>:\r\n    words = contents.split()\r\n    num_words = len(words)\r\n    print(f<span style=\"color: #60ac39;\">'The file {filename} has about {num_words} words.'<\/span>)\r\n<\/code><\/pre>\n<p>\u8be5\u811a\u672c\u7684\u8f93\u51fa\uff1a<\/p>\n<p>The file \/usr\/share\/doc\/grep\/README has about 372 words.<\/p>\n<p>\u8ba9\u6211\u4eec\u7528wc\u9a8c\u8bc1\u8f93\u51fa\uff1a<\/p>\n<p>linuxmi@linuxmi:~\/www.linuxmi.com$ wc -w \/usr\/share\/doc\/grep\/README<br \/>\n372 \/usr\/share\/doc\/grep\/README<\/p>\n<p>\u56e0\u6b64\uff0c\u6211\u4eec\u7684\u811a\u672c\u548cwc\u7684\u8f93\u51fa\u662f\u76f8\u540c\u7684\uff0c\u8fd9\u610f\u5473\u7740split()\u6210\u529f\u5730\u5206\u9694\u4e86\u5355\u8bcd\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4169\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2020\/11\/words.png\" alt=\"\" width=\"1004\" height=\"728\" \/><\/p>\n<p><strong>\u793a\u4f8b5\uff1a<\/strong>\u4f7f\u7528\u4e00\u4e2a\u5e26\u6709for\u5faa\u73af\u7684line\u5206\u5272\u5b57\u7b26\u4e32<\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u4e00\u4e2aline\u4ee3\u7801\u6765\u5206\u5272\u5b57\u7b26\u4e32\u5e76\u6253\u5370\u8d85\u8fc75\u4e2a\u5b57\u7b26\u7684\u5355\u8bcd\u3002<\/p>\n<pre style=\"margin: 1.2em 0px; line-height: 1.2em; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em;\"><code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\"><span style=\"color: #999580;\">#!\/usr\/bin\/env python3<\/span>\r\n\r\nmystring = <span style=\"color: #60ac39;\">'linuxmi.com we are testing python split strin'<\/span>\r\n\r\n<span style=\"color: #999580;\">## One-Liner<\/span>\r\nw = [[x <span style=\"color: #b854d4;\">for<\/span> x <span style=\"color: #b854d4;\">in<\/span> line.split() <span style=\"color: #b854d4;\">if<\/span> len(x)&gt;<span style=\"color: #b65611;\">5<\/span>] <span style=\"color: #b854d4;\">for<\/span> line <span style=\"color: #b854d4;\">in<\/span> mystring.split(<span style=\"color: #60ac39;\">'\\n'<\/span>)]\r\n\r\n<span style=\"color: #999580;\">## Result<\/span>\r\nprint(w)\r\n<\/code><\/pre>\n<p>\u8bf4\u660e<\/p>\n<ul>\n<li>\u5185\u90e8\u5217\u8868\u7406\u89e3\u8868\u8fbe\u5f0f<code style=\"background: #292824; margin: 0px 0.15em; padding: 0.5em; border-radius: 3px; border: 1px solid #cccccc; color: #a6a28c; overflow: auto; font-family: Consolas, Inconsolata, Courier, monospace; font-size: 0.85em; display: block !important; white-space: pre; -ms-overflow-x: auto; -moz-text-size-adjust: none;\">x <span style=\"color: #b854d4;\">for<\/span> x <span style=\"color: #b854d4;\">in<\/span> line.split() <span style=\"color: #b854d4;\">if<\/span> len(x)&gt;<span style=\"color: #b65611;\">5<\/span><\/code>\u4f7f\u7528\u5b57\u7b26\u4e32<code>split()<\/code>\u51fd\u6570\u5c06\u7ed9\u5b9a\u7684\u884c\u5212\u5206\u4e3a\u5355\u8bcd\u5e8f\u5217\u3002\u6211\u4eec\u904d\u5386\u6240\u6709\u5355\u8bcd<code>x<\/code>\uff0c\u5982\u679c\u5b83\u4eec\u7684\u5b57\u7b26\u6570\u8d85\u8fc75\u4e2a\uff0c\u5219\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\u3002<\/li>\n<li>\u5916\u90e8\u5217\u8868\u7406\u89e3\u8868\u8fbe\u5f0f\u521b\u5efa\u4e0a\u4e00\u6761\u8bed\u53e5\u4e2d\u4f7f\u7528\u7684\u5b57\u7b26\u4e32\u884c\u3002\u518d\u6b21\uff0c\u5b83\u4f7f\u7528<code>split()<\/code>\u51fd\u6570<code>mystring<\/code>\u5728\u6362\u884c\u7b26\u4e0a\u5206\u5272<code>'\\n'<\/code>\u3002<\/li>\n<\/ul>\n<p>\u8be5\u811a\u672c\u7684\u8f93\u51fa\uff1a<\/p>\n<p>[[&#8216;linuxmi.com&#8217;, &#8216;testing&#8217;, &#8216;python&#8217;]]<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4168\" src=\"https:\/\/www.linuxmi.com\/wp-content\/uploads\/2020\/11\/python.png\" alt=\"\" width=\"1004\" height=\"584\" \/><\/p>\n<p><strong>\u7ed3\u8bba<\/strong><\/p>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55string.split()\u4f7f\u7528\u4e0d\u540c\u7684\u793a\u4f8b\u3002\u6211\u4eec\u53ef\u4ee5\u5c06split\u4e0eregex\u7ed3\u5408\u4f7f\u7528\u4ee5\u6dfb\u52a0\u66f4\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u8fd9\u4e9b\u529f\u80fd\u5c06\u5728\u4ee5\u540e\u7684\u6559\u7a0b\u4e2d\u4ecb\u7ecd\u3002\u5728\u8fd9\u91cc\uff0c\u6db5\u76d6\u4e86\u5728\u4e0d\u540c\u60c5\u51b5\u4e0b\u5c06\u5176\u4e0e\u5b57\u7b26\u4e32\u4e00\u8d77\u4f7f\u7528\u76845\u4e2a\u793a\u4f8b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8fd9\u4e2aPython\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60Python split()\u5b57\u7b26\u4e32\u51fd\u6570\u3002\u4e0elen()\u4e0d\u540c\uff0c\u6709\u4e9b\u51fd &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-4163","post","type-post","status-publish","format-standard","hentry","category-python"],"aioseo_notices":[],"views":707,"_links":{"self":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/4163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/comments?post=4163"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/4163\/revisions"}],"predecessor-version":[{"id":4172,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/posts\/4163\/revisions\/4172"}],"wp:attachment":[{"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/media?parent=4163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/categories?post=4163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxmi.com\/wp-json\/wp\/v2\/tags?post=4163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}