{"id":169905,"date":"2020-10-21T08:39:59","date_gmt":"2020-10-21T00:39:59","guid":{"rendered":"http:\/\/4563.org\/?p=169905"},"modified":"2020-10-21T08:39:59","modified_gmt":"2020-10-21T00:39:59","slug":"python-%e5%a6%82%e4%bd%95%e9%80%90%e4%b8%aa%e8%af%bb%e5%8f%96%e5%9c%a8%e5%90%8c%e4%b8%80%e8%a1%8c%e4%b8%ad%e4%bb%a5%e7%a9%ba%e6%a0%bc%e5%88%86%e9%9a%94%e7%9a%84%e6%95%b0%e6%8d%ae%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=169905","title":{"rendered":"Python \u5982\u4f55\u9010\u4e2a\u8bfb\u53d6\u5728\u540c\u4e00\u884c\u4e2d\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u6570\u636e\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python \u5982\u4f55\u9010\u4e2a\u8bfb\u53d6\u5728\u540c\u4e00\u884c\u4e2d\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u6570\u636e\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KIRAYOMATO <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6bd4\u5982 1 2 3 4 5 \u8fd9\u6837\u7684<br \/>\u7f51\u4e0a\u627e\u5230\u7684\u53ea\u6709\u7528 list(map(lambda x :int(x),input().split()))\u6765\u628a\u4e00\u6574\u884c\u626b\u6210\u4e00\u4e2a\u5217\u8868<br \/>\u4f46\u662f\u8fd9\u6837\u5b50\u5982\u679c\u6570\u636e\u592a\u591a\u7684\u8bdd oj \u5c31\u4f1a\u7206\u5185\u5b58\u3002      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>5<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3836281\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             oj \u662f\u4ec0\u4e48\uff1f<\/p>\n<p>\u5176\u5b9e\u4e0d\u77e5\u9053\u600e\u4e48\u56de\u7b54\uff0c\u95ee\u9898\u4f60\u81ea\u5df1\u5df2\u7ecf\u7b54\u4e86<br \/>\u81f3\u4e8e\u4f60\u8bf4\u5185\u5b58\u4f1a\u7206\uff0c\u90a3\u662f\u4e1a\u52a1\u6d41\u7a0b\uff0c\u597d\u50cf\u8ddf\u4e0d\u662f\u201c\u5982\u4f55\u8bfb\u53d6\u201d\u7684\u95ee\u9898<\/p>\n<p>\u6015\u5185\u5b58\u7206\uff0c\u5c31\u8bfb\u4e00\u884c\u5904\u7406\u4e00\u884c\u5457                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3836282\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ysc3839 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u5df1\u6839\u636e split \u7684\u7b97\u6cd5\uff0c\u914d\u5408 Python \u7684 generator \u5b9e\u73b0\u4e00\u4e2a\u5373\u53ef\u3002<br \/>\u8fd9\u91cc\u7ed9\u4e00\u4e2a\u53ea\u80fd\u5206\u5272\u5355\u4e2a\u5b57\u7b26\u7684\u7248\u672c\u4f5c\u4e3a\u53c2\u8003\u3002\u7531\u4e8e V2EX \u4f1a\u5220\u9664\u6bcf\u884c\u5f00\u5934\u7684\u7a7a\u683c\uff0c\u9700\u8981\u4f60\u81ea\u5df1\u8865\u5168\u7a7a\u683c\u4f7f\u5176\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n<p>def lazy_split(str, sep):<br \/> start = end = 0<br \/> for ch in str:<br \/> if ch == sep:<br \/> yield str[start:end]<br \/>  start = end + 1<br \/> end += 1<br \/> yield str[start:]<\/p>\n<p>if __name__ == &#8216;__main__&#8217;:<br \/> for i in lazy_split(&#8216;abc bcd cde def&#8217;, &#8216; &#8216;):<br \/> print(repr(i))                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3836283\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : luckyrayyy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             oj?\u90a3\u4f60\u987a\u5e8f\u8bfb\u53d6\uff0c\u9047\u5230\u7a7a\u683c\u5c31\u6254\u6389\u4e0d\u5c31\u884c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3836284\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : learningman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b97\u6cd5\u9898\u62ff Python \u5199\u3002\u3002\u3002\uff1f<br \/>\u6211\u89c9\u5f97 Java \u90fd\u6709\u70b9\u96be                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3836285\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : KIRAYOMATO <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u662f\u540c\u4e00\u884c\u91cc\u9762\u6709\u7279\u522b\u591a\u4ee5\u7a7a\u683c\u5206\u9694\u7684\u6570\u636e\uff0c\u5168\u90e8\u653e\u5728\u4e00\u4e2a list \u91cc\u9762\u7684\u8bdd\u5185\u5b58\u5360\u7528\u4f1a\u8d85\u8fc7\u9898\u76ee\u9650\u5236                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python \u5982\u4f55\u9010\u4e2a\u8bfb\u53d6\u5728\u540c\u4e00\u884c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169905"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169905"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/169905\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169905"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}