{"id":231,"date":"2017-01-10T13:53:35","date_gmt":"2017-01-10T05:53:35","guid":{"rendered":"http:\/\/luchanglong.com.cn\/?p=231"},"modified":"2017-01-17T14:36:23","modified_gmt":"2017-01-17T06:36:23","slug":"python-%e8%bf%ad%e4%bb%a3","status":"publish","type":"post","link":"https:\/\/blog.la998.com\/?p=231","title":{"rendered":"python \u8fed\u4ee3 for&#8230; in"},"content":{"rendered":"<p>\u4efb\u4f55\u53ef\u8fed\u4ee3\u5bf9\u8c61\u90fd\u53ef\u4ee5\u4f5c\u7528\u4e8e<code>for<\/code>\u5faa\u73af\uff0c\u5305\u62ec\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u7c7b\u578b\uff0c\u53ea\u8981\u7b26\u5408\u8fed\u4ee3\u6761\u4ef6\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528<code>for<\/code>\u5faa\u73af\u3002<\/p>\n<p>\u5224\u65ad\u4e00\u4e2a\u5bf9\u8c61\u662f\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff1a<\/p>\n<pre><code class=\"python\"><span class=\"prompt\">&gt;&gt;&gt; <\/span><span class=\"keyword\">from<\/span> collections <span class=\"keyword\">import<\/span> Iterable\r\n<span class=\"prompt\">&gt;&gt;&gt; <\/span>isinstance(<span class=\"string\">'abc'<\/span>, Iterable) <span class=\"comment\"># str\u662f\u5426\u53ef\u8fed\u4ee3<\/span>\r\n<span class=\"built_in\">True<\/span>\r\n<span class=\"prompt\">&gt;&gt;&gt; <\/span>isinstance([<span class=\"number\">1<\/span>,<span class=\"number\">2<\/span>,<span class=\"number\">3<\/span>], Iterable) <span class=\"comment\"># list\u662f\u5426\u53ef\u8fed\u4ee3<\/span>\r\n<span class=\"built_in\">True<\/span>\r\n<span class=\"prompt\">&gt;&gt;&gt; <\/span>isinstance(<span class=\"number\">123<\/span>, Iterable) <span class=\"comment\"># \u6574\u6570\u662f\u5426\u53ef\u8fed\u4ee3<\/span>\r\n<span class=\"built_in\">False<\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4efb\u4f55\u53ef\u8fed\u4ee3\u5bf9\u8c61\u90fd\u53ef\u4ee5\u4f5c\u7528\u4e8efor\u5faa\u73af\uff0c\u5305\u62ec\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u7c7b\u578b\uff0c\u53ea\u8981\u7b26\u5408\u8fed\u4ee3\u6761\u4ef6\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528for\u5faa\u73af\u3002 \u5224\u65ad &hellip; <a href=\"https:\/\/blog.la998.com\/?p=231\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">python \u8fed\u4ee3 for&#8230; in<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-231","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=231"}],"version-history":[{"count":2,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":233,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/231\/revisions\/233"}],"wp:attachment":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}