{"id":49670,"date":"2024-12-03T14:23:08","date_gmt":"2024-12-03T06:23:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49670\/"},"modified":"2024-12-03T14:23:08","modified_gmt":"2024-12-03T06:23:08","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%8c%b9%e9%85%8d%e8%bf%9e%e7%bb%ad%e4%b8%89%e4%b8%aa%e6%95%b0%e5%ad%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49670\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f <\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f \u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241031\/1730352469672315550f5fd.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u67e5\u627e\u8fde\u7eed\u7684\u4e09\u4e2a\u6570\u5b57<\/strong><\/p>\n<p>\u6587\u672c\u4e2d\u9700\u8981\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u7684\u6570\u5b57\uff0c\u65e2\u4e0d\u80fd\u5c11\u4e8e 3 \u4e2a\u6570\u5b57\uff0c\u4e5f\u4e0d\u80fd\u591a\u4e8e 3 \u4e2a\u6570\u5b57\u3002<\/p>\n<p><strong>\u4fee\u6539\u540e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/strong><\/p>\n<p>\u7531\u4e8e\u95ee\u9898\u6761\u4ef6\u5df2\u66f4\u65b0\uff0c\u56e0\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u8fdb\u884c\u4e86\u4fee\u6539\uff0c\u4ee5\u540c\u65f6\u652f\u6301 python \u548c\u591a\u7ec4\u6570\u5b57\u7684\u5339\u914d\uff1a<\/p>\n<pre>import re\n\ndata = [\n    '123',\n    '123u',\n    'u123',\n    'x123y',\n    '1234',\n    'x1234y',\n    '12',\n    '123y456',\n]\n\nfor s in data:\n    print(re.findall(r'(?&amp;lt;!\\d)(\\d{3})(?!\\d)', s))<\/pre>\n<p><strong>\u8f93\u51fa<\/strong><\/p>\n<pre>['123']\n['123']\n['123']\n['123']\n[]\n[]\n[]\n['123', '456']<\/pre>\n<p>\u672c\u7bc7\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f \u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f \u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f \u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002 \u67e5\u627e\u8fde\u7eed\u7684\u4e09\u4e2a\u6570\u5b57 \u6587\u672c\u4e2d\u9700\u8981\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u7684\u6570\u5b57\uff0c\u65e2\u4e0d\u80fd\u5c11\u4e8e 3 \u4e2a\u6570\u5b57\uff0c\u4e5f\u4e0d\u80fd\u591a\u4e8e 3 \u4e2a\u6570\u5b57\u3002 \u4fee\u6539\u540e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f \u7531\u4e8e\u95ee\u9898\u6761\u4ef6\u5df2\u66f4\u65b0\uff0c\u56e0\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u8fdb\u884c\u4e86\u4fee\u6539\uff0c\u4ee5\u540c\u65f6\u652f\u6301 python \u548c\u591a\u7ec4\u6570\u5b57\u7684\u5339\u914d\uff1a import re data = [ &#8216;123&#8217;, &#8216;123u&#8217;, &#8216;u123&#8217;, &#8216;x123y&#8217;, &#8216;1234&#8217;, &#8216;x1234y&#8217;, &#8217;12&#8217;, &#8216;123y456&#8242;, ] for s in data: print(re.findall(r'(?&amp;lt;!\\d)(\\d{3})(?!\\d)&#8217;, s)) \u8f93\u51fa [&#8216;123&#8217;] [&#8216;123&#8217;] [&#8216;123&#8217;] [&#8216;123&#8217;] [] [] [] [&#8216;123&#8217;, &#8216;456&#8217;] \u672c\u7bc7\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u8fde\u7eed\u4e09\u4e2a\u6570\u5b57\uff1f \u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49670","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49670"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49670\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}