{"id":229,"date":"2017-02-03T01:45:11","date_gmt":"2017-02-02T17:45:11","guid":{"rendered":"http:\/\/www.rainweb.site\/?p=229"},"modified":"2017-02-03T01:45:11","modified_gmt":"2017-02-02T17:45:11","slug":"python-article0009","status":"publish","type":"post","link":"http:\/\/rain1024.com\/index.php\/2017\/02\/03\/python-article0009\/","title":{"rendered":"Python68\u4e2a\u5185\u7f6e\u51fd\u6570"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-230\" src=\"http:\/\/47.93.162.35\/wp-content\/uploads\/2017\/02\/82956687.png\" alt=\"\" width=\"948\" height=\"394\" srcset=\"http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/82956687.png 948w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/82956687-300x125.png 300w, http:\/\/rain1024.com\/wp-content\/uploads\/2017\/02\/82956687-768x319.png 768w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/p>\n<h5>\u4ee5\u4e0b\u662f\u6458\u5f55\u7684python\u768468\u4e2a\u5185\u7f6e\u51fd\u6570\uff0c\u672c\u6765\u60f3\u8ba4\u771f\u7684\u90fd\u6572\u4e00\u904d\uff0c\u540e\u6765\u53d1\u73b0\u6709\u4e9b\u53ef\u4ee5\u76f4\u63a5\u7528\uff0c\u6ca1\u5fc5\u8981\u518d\u91cd\u65b0\u5199\uff0c\u770b\u4e00\u4e0b\u4e5f\u5c31\u4f1a\u7528\u4e86\uff0c\u6240\u4ee5\u5148\u66f4\u65b0\u8fd9\u4e48\u591a\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u81ea\u5df1\u591a\u7814\u7a76\u7814\u7a76<\/h5>\n<ol>\n<li>abs\uff1a\u8fd4\u56de\u6240\u7ed9\u6570\u7684\u7edd\u5bf9\u503c\uff0c\u53ef\u4ee5\u662f\u6574\u6570\uff0c\u6d6e\u70b9\u6570\uff0c\u7b97\u672f\u8868\u8fbe\u5f0f\uff0c\u590d\u6570\uff08\u8fd4\u56de\u590d\u6570\u5b9e\u90e8\u548c\u865a\u90e8\u7684\u5e73\u65b9\u548c\u5f00\u6839\u53f7\uff0c\u52fe\u80a1\u5b9a\u7406\uff09<\/li>\n<\/ol>\n<pre><code>\u4ee3\u7801Code\uff1a\nint_num = -10\nfloat_num = -10.01\nprint abs(int_num)\nprint abs(float_num)\nprint abs(10-20)\n----------\u5206\u5272\u7ebf------------\n\u7ed3\u679cResult:\n10\n10.01\n10\n<\/code><\/pre>\n<ol>\n<li>all\uff1a\u904d\u5386\u4e00\u4e2a\u5bb9\u5668\uff0c\u5982\u679c\u5bb9\u5668\u4e3a\u7a7a\u6216\u8005\u6240\u6709\u5143\u7d20\u90fd\u8fd4\u56deTrue\uff0c\u90a3\u4e48all\u8fd4\u56deTrue\uff0c\u5bb9\u5668\u4e3a\u7a7a\uff0c\u6216\u8005\u91cc\u9762\u7684\u503c\u4e0d\u4e3a\u96f6\uff0c\u8fd4\u56de\u503c\u90fd\u662fTrue\uff0c\u53ea\u8981\u6709\u4e00\u4e2a\u5143\u7d20\u4e3a0\u5c31\u8fd4\u56deFalse\u3002<\/li>\n<\/ol>\n<pre><code>\u4ee3\u7801Code\uff1a\nlist_empty = []\nlist_num_first = [1,1,1]\nlist_num_zero = [0]\nlist_mixtrue = [1,0,1]\nprint all(list_empty)\nprint all(list_num_first)\nprint all(list_num_zero)\nprint all(list_mixtrue)\n----------\u5206\u5272\u7ebf------------\n\u7ed3\u679cResult:\nTrue\nTrue\nFalse\nFalse\n<\/code><\/pre>\n<ol>\n<li>any: \u82e5\u5bb9\u5668\u4e3a\u7a7a\u5219\u8fd4\u56deFalse,\u6216\u53ea\u6709\u4e00\u4e2a\u5143\u7d20\u5e76\u4e14\u4e3a0\uff0c\u5c31\u8fd4\u56deFalse\u3002<\/li>\n<li>ascii\uff1a---\u4e0d\u5e38\u7528<\/li>\n<li>bin\uff1a\u5c06\u6574\u6570\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u7684<strong>\u5b57\u7b26\u4e32<\/strong><\/li>\n<li>bool\uff1a\u5c06\u5143\u7d20\u8f6c\u6362\u4e3abool\u7c7b\u578b\uff0c\u6574\u65700\u4e3aFalse\uff0c\u5b57\u7b26\u4e32\u4e3a\u7a7a\u65f6\u4e3aFalse<\/li>\n<li>bytearray\uff1a\u8fd4\u56de\u4e00\u4e2a\u5b57\u8282\u6570\u636e---\u4e0d\u5e38\u7528<\/li>\n<li>bytes\uff1a\u6839\u636e\u4e00\u4e2a\u7f16\u7801\u8f6c\u6362\u6210\u5b57\u8282\u5f62\u5f0f---\u4e0d\u5e38\u7528<\/li>\n<li>chr\uff1a\u8fd4\u56de\u7684\u662f\u6574\u6570\u5bf9\u5e94\u7684ascii\u5b57\u7b26\uff0c\u6bd4\u598297\u8fd4\u56dea\uff0c48\u8fd4\u56de0<\/li>\n<li>classmethod\uff1a\u4e3a\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u7c7b\u65b9\u6cd5<\/li>\n<\/ol>\n<pre><code>\u4ee3\u7801Code\uff1a\ndef fun():\n    print 123\nprint classmethod(fun())\n----------\u5206\u5272\u7ebf------------\n\u7ed3\u679cResult:\n123\n&lt;classmethod object at 0x02E555F0&gt;\n<\/code><\/pre>\n<ol>\n<li>compile\uff1a\u7f16\u8bd1\u4e00\u4e2a\u8d44\u6e90\u8fdb\u5165\u4e00\u4e2a\u4ee3\u7801\u91cc\u6216\u4e00\u4e2aAST\u5bf9\u8c61--\uff08\u6ca1\u7528\u8fc7\uff09<\/li>\n<li>complex\uff1a\u521b\u5efa\u4e00\u4e2a\u590d\u6570\u7684\u8868\u8fbe\u5f0f<\/li>\n<li>delattr\uff1a\u79fb\u9664\u4e00\u4e2a\u5bf9\u8c61\u7684\u5c5e\u6027<\/li>\n<li>dict\uff1a\u521b\u5efa\u4e00\u4e2a\u8bcd\u5178\u7ed3\u6784(\u7c7b\u4f3cMap)<\/li>\n<li>dir\uff1a\u5982\u679c\u6ca1\u6709\u53c2\u6570\u8fd4\u56de\u672c\u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5982\u679c\u6709\u53c2\u6570\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u7684\u5c5e\u6027\u5217\u8868<\/li>\n<li>divmod\uff1a\u4e24\u4e2a\u6574\u5f62\u6570\u5b57\u505a\u76f8\u9664<\/li>\n<li>enumerate\uff1a\u8fd4\u56de\u4e00\u4e2a\u679a\u4e3e\u5bf9\u8c61<\/li>\n<li>eval\uff1a\u6267\u884c\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u6216\u5b57\u7b26\u4e32\u4f5c\u4e3a\u8fd0\u7b97<\/li>\n<li>exec\uff1a\u652f\u6301python\u4ee3\u7801\u7684\u52a8\u6001\u6267\u884c<\/li>\n<li>filter\uff1a\u5728\u4e00\u4e2a\u5143\u7ec4\u91cc\u9762\u8fc7\u6ee4\u51fa\u76ee\u6807\u5b57\u7b26\u4e32<\/li>\n<li>float\uff1a\u5b57\u7b26\u4e32\u8f6c\u6210\u6d6e\u70b9\u7c7b\u578b<\/li>\n<li>format\uff1a\u683c\u5f0f\u5316\u5b57\u7b26\u4e32<\/li>\n<li>frozenset\uff1a\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u514b\u9686\u5bf9\u8c61<\/li>\n<li>getattr\uff1a\u83b7\u53d6\u5bf9\u8c61\u7684\u4e00\u4e2a\u65b9\u6cd5\u7684\u7ed3\u679c\uff0c\u7c7b\u4f3c\u4e8ex.foobar<\/li>\n<li>globals:\u8fd4\u56de\u5f53\u524d\u5168\u5c40\u7684\u5b57\u5178\u8868<\/li>\n<li>hasattr\uff1a\u5224\u65ad\u662f\u5426\u6709\u67d0\u4e2a\u5c5e\u6027\u503c\uff0c\u8fd4\u56detrue\u4ee3\u8868\u6709<\/li>\n<li>hash\uff1a\u53d6\u4e00\u4e2a\u5bf9\u8c61\u7684hash\u503c<\/li>\n<li>help\uff1a\u8c03\u7528\u7cfb\u7edf\u5185\u7f6e\u7684\u5e2e\u52a9\u7cfb\u7edf<\/li>\n<li>hex\uff1a\u8f6c\u6362\u4e00\u4e2a\u6574\u5f62\u6570\u5b57\uff0c\u4e3a\u5c0f\u5199\u7684\u5341\u516d\u8fdb\u5236<\/li>\n<li>id\uff1a\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u7684\u552f\u4e00\u6807\u8bc6\u503c<\/li>\n<li>input\uff1a\u4ece\u63a7\u5236\u53f0\u8bfb\u53d6\u6570\u636e<\/li>\n<li>int\uff1a\u8f6c\u6362\u5b57\u7b26\u4e32\u4e3aint\u578b<\/li>\n<li>isinstance\uff1a\u5224\u65ad\u4e00\u4e2a\u5bf9\u8c61\u662f\u5426\u4e3a\u8be5\u7c7b\u7684\u4e00\u4e2a\u5b9e\u4f8b<\/li>\n<li>issubclass\uff1a\u5224\u65ad\u4e00\u4e2a\u7c7b\u662f\u5426\u4e3a\u53e6\u4e00\u4e2a\u7c7b\u7684\u5b50\u7c7b<\/li>\n<li>iter\uff1a\u8fd4\u56de\u4e00\u4e2a\u53ef\u8fed\u4ee3\u7684\u5bf9\u8c61<\/li>\n<li>len\uff1a\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u4e32\u6216\u5bb9\u5668\u7684\u957f\u5ea6<\/li>\n<li>list\uff1a\u6253\u5370\u4e00\u4e2a\u96c6\u5408\u5bf9\u8c61<\/li>\n<li>locals\uff1a\u66f4\u7ec6\u5e76\u8fd4\u56de\u4e00\u4e2a\u8bcd\u5178\u7684\u672c\u5730\u6807\u5fd7\u8868<\/li>\n<li>map\uff1a\u8fd4\u56de\u4e00\u4e2a\u53ef\u8fed\u4ee3\u7684map\u51fd\u6570<\/li>\n<li>max\uff1a\u8fd4\u56de\u96c6\u5408\u91cc\u9762\u6700\u5927\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u503c<\/li>\n<li>memoryview\uff1a\u8fd4\u56de\u4e00\u4e2apython\u5bf9\u8c61\u7684\u5185\u90e8\u6570\u636e<\/li>\n<li>min\uff1a\u8fd4\u56de\u96c6\u5408\u91cc\u9762\u6700\u5c0f\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u503c<\/li>\n<li>next\uff1a\u8fd4\u56de\u96c6\u5408\u91cc\u9762\u7684\u4e0b\u4e00\u9879\u6570\u503c<\/li>\n<li>object\uff1a\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\uff0c\u662f\u6240\u6709\u7684\u7c7b\u7684\u7236\u7c7b<\/li>\n<li>oct\uff1a\u8fd4\u56de\u4e00\u4e2a\u6574\u5f62\u4e3a\u516b\u8fdb\u5236\u7c7b\u578b<\/li>\n<li>open\uff1a\u6253\u5f00\u4e00\u4e2a\u7cfb\u7edf\u6587\u4ef6<\/li>\n<li>ord\uff1a\u5f97\u5230\u4e00\u4e2a\u5b57\u7b26\u6216unicode\u7c7b\u578b\u7684ascii\u6570\u503c<\/li>\n<li>pow\uff1a\u8fd4\u56de\u7684\u6570\u5b57n\u6b21\u65b9\u503c\uff0c\u8ddf**\u64cd\u4f5c\u7b26\u662f\u4e00\u6837\u7684\u6548\u679c<\/li>\n<li>print\uff1a\u6253\u5370\u8f93\u51fa\u8bed\u53e5\uff0c\u5728python3.0\u4ee5\u540eprint\u5c31\u662f\u4e00\u4e2a\u51fd\u6570\u4e86\uff0c\u9700\u8981\u52a0\u62ec\u53f7<\/li>\n<li>property\uff1a\u8fd4\u56de\u4e00\u4e2a\u5c5e\u6027\u503c<\/li>\n<li>range\uff1a\u4ea7\u751f\u4e00\u4e2a\u6570\u5b57\u5e8f\u5217<\/li>\n<li>repr\uff1a\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u4e32\u53ef\u6253\u5370\u5bf9\u8c61<\/li>\n<li>reversed\uff1a\u53cd\u8f6c\u4e00\u4e2a\u96c6\u5408<\/li>\n<li>round\uff1a\u8fd4\u56de\u4e00\u4e2a\u56db\u820d\u4e94\u5165\u7684\u6d6e\u70b9\u6570<\/li>\n<li>set\uff1a\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684set\u5bf9\u8c61<\/li>\n<li>setattr\uff1a\u8bbe\u7f6e\u4e00\u4e2a\u65b0\u7684\u5c5e\u6027\u503c<\/li>\n<li>slice\uff1a\u8fd4\u56de\u4e00\u4e2a\u96c6\u5408\u7684\u533a\u95f4\u96c6\u5408<\/li>\n<li>sorted\uff1a\u5bf9\u4e00\u4e2a\u96c6\u5408\u8fdb\u884c\u6392\u5e8f<\/li>\n<li>staticmethod\uff1a\u58f0\u660e\u8fd4\u56de\u4e00\u4e2a\u9759\u6001\u65b9\u6cd5<\/li>\n<li>str\uff1a\u5c06\u6570\u5b57\u7c7b\u578b\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32<\/li>\n<li>sum\uff1a\u5bf9\u4e00\u4e2a\u96c6\u5408\u91cc\u9762\u7684\u503c\u6c42\u548c<\/li>\n<li>super\uff1a\u8fd4\u56de\u4e00\u4e2a\u4ee3\u7406\u7236\u7c7b\u7684\u5bf9\u8c61<\/li>\n<li>tuple\uff1a\u8fd4\u56de\u4e00\u4e2a\u4e0d\u53ef\u53d8\u7684\u5143\u7ec4<\/li>\n<li>type\uff1a\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u7684\u7c7b\u578b<\/li>\n<li>vars\uff1a\u8fd4\u56de\u5bf9\u8c61\u7684\u5c5e\u6027<\/li>\n<li>zip\uff1a\u8fd4\u56de\u7ec4\u5408\u4e00\u4e2a\u5bf9\u7b49\u7684\u9879<\/li>\n<li><strong>import<\/strong>\uff1a\u6bd4import\u9ad8\u7ea7\u7684\u5bfc\u5165\u65b9\u6cd5<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u6458\u5f55\u7684python\u768468\u4e2a\u5185\u7f6e\u51fd\u6570\uff0c\u672c\u6765\u60f3\u8ba4\u771f\u7684\u90fd\u6572\u4e00\u904d\uff0c\u540e\u6765\u53d1\u73b0\u6709\u4e9b\u53ef\u4ee5\u76f4\u63a5\u7528\uff0c\u6ca1\u5fc5\u8981\u518d\u91cd\u65b0\u5199\uff0c\u770b\u4e00\u4e0b\u2026 <span class=\"read-more\"><a href=\"http:\/\/rain1024.com\/index.php\/2017\/02\/03\/python-article0009\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":97,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[15],"tags":[58],"class_list":["post-229","post","type-post","status-publish","format-aside","has-post-thumbnail","hentry","category-python","tag-python","post_format-post-format-aside"],"_links":{"self":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":0,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media\/97"}],"wp:attachment":[{"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rain1024.com\/index.php\/wp-json\/wp\/v2\/tags?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}