{"id":8723,"date":"2023-05-15T17:09:17","date_gmt":"2023-05-15T09:09:17","guid":{"rendered":"\/?p=8723"},"modified":"2023-05-15T17:09:17","modified_gmt":"2023-05-15T09:09:17","slug":"python%e5%86%85%e7%bd%ae%e5%87%bd%e6%95%b0%e4%b8%80%e8%a7%88%e8%a1%a8","status":"publish","type":"post","link":"\/?p=8723","title":{"rendered":"Python\u5185\u7f6e\u51fd\u6570\u4e00\u89c8\u8868"},"content":{"rendered":"<p><strong>\u5b98\u65b9\u6587\u6863\uff1a<\/strong><a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/functions.html\">https:\/\/docs.python.org\/zh-cn\/3\/library\/functions.html<\/a> <\/p>\n<p>\u89e3\u91ca\u5668\u81ea\u5e26\u7684\u51fd\u6570\u53eb\u505a\u5185\u7f6e\u51fd\u6570\uff0c\u8fd9\u4e9b\u51fd\u6570\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\uff0c\u4e0d\u9700\u8981\u5bfc\u5165\u67d0\u4e2a\u6a21\u5757\u3002<\/p>\n<p>\u5982\u679c\u4f60\u719f\u6089 Shell \u7f16\u7a0b\uff0c\u4e86\u89e3\u4ec0\u4e48\u662f <a href=\"http:\/\/c.biancheng.net\/view\/1136.html\">Shell \u5185\u7f6e\u547d\u4ee4<\/a>\uff0c\u90a3\u4e48\u4f60\u4e5f\u5f88\u5bb9\u6613\u7406\u89e3\u4ec0\u4e48\u662f Python \u5185\u7f6e\u51fd\u6570\uff0c\u5b83\u4eec\u7684\u6982\u5ff5\u662f\u7c7b\u4f3c\u7684\u3002<\/p>\n<p>\u5c06\u4f7f\u7528\u9891\u7e41\u7684\u4ee3\u7801\u6bb5\u5c01\u88c5\u8d77\u6765\uff0c\u5e76\u7ed9\u5b83\u8d77\u4e00\u4e2a\u540d\u5b57\uff0c\u4ee5\u540e\u4f7f\u7528\u7684\u65f6\u5019\u53ea\u8981\u77e5\u9053\u540d\u5b57\u5c31\u53ef\u4ee5\uff0c\u8fd9\u5c31\u662f\u51fd\u6570\u3002\u51fd\u6570\u5c31\u662f\u4e00\u6bb5\u5c01\u88c5\u597d\u7684\u3001\u53ef\u4ee5\u91cd\u590d\u4f7f\u7528\u7684\u4ee3\u7801\uff0c\u5b83\u4f7f\u5f97\u6211\u4eec\u7684\u7a0b\u5e8f\u66f4\u52a0\u6a21\u5757\u5316\uff0c\u4e0d\u9700\u8981\u7f16\u5199\u5927\u91cf\u91cd\u590d\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u5185\u7f6e\u51fd\u6570\u548c\u6807\u51c6\u5e93\u51fd\u6570\u662f\u4e0d\u4e00\u6837\u7684\u3002<\/p>\n<p>Python \u89e3\u91ca\u5668\u4e5f\u662f\u4e00\u4e2a\u7a0b\u5e8f\uff0c\u5b83\u7ed9\u7528\u6237\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u7528\u529f\u80fd\uff0c\u5e76\u7ed9\u5b83\u4eec\u8d77\u4e86\u72ec\u4e00\u65e0\u4e8c\u7684\u540d\u5b57\uff0c\u8fd9\u4e9b\u5e38\u7528\u529f\u80fd\u5c31\u662f\u5185\u7f6e\u51fd\u6570\u3002Python \u89e3\u91ca\u5668\u542f\u52a8\u4ee5\u540e\uff0c\u5185\u7f6e\u51fd\u6570\u4e5f\u751f\u6548\u4e86\uff0c\u53ef\u4ee5\u76f4\u63a5\u62ff\u6765\u4f7f\u7528\u3002<\/p>\n<p>Python \u6807\u51c6\u5e93\u76f8\u5f53\u4e8e\u89e3\u91ca\u5668\u7684\u5916\u90e8\u6269\u5c55\uff0c\u5b83\u5e76\u4e0d\u4f1a\u968f\u7740\u89e3\u91ca\u5668\u7684\u542f\u52a8\u800c\u542f\u52a8\uff0c\u8981\u60f3\u4f7f\u7528\u8fd9\u4e9b\u5916\u90e8\u6269\u5c55\uff0c\u5fc5\u987b\u63d0\u524d\u5bfc\u5165\u3002Python \u6807\u51c6\u5e93\u975e\u5e38\u5e9e\u5927\uff0c\u5305\u542b\u4e86\u5f88\u591a\u6a21\u5757\uff0c\u8981\u60f3\u4f7f\u7528\u67d0\u4e2a\u51fd\u6570\uff0c\u5fc5\u987b\u63d0\u524d\u5bfc\u5165\u5bf9\u5e94\u7684\u6a21\u5757\uff0c\u5426\u5219\u51fd\u6570\u662f\u65e0\u6548\u7684\u3002<\/p>\n<p>\u5185\u7f6e\u51fd\u6570\u662f\u89e3\u91ca\u5668\u7684\u4e00\u90e8\u5206\uff0c\u5b83\u968f\u7740\u89e3\u91ca\u5668\u7684\u542f\u52a8\u800c\u751f\u6548\uff1b\u6807\u51c6\u5e93\u51fd\u6570\u662f\u89e3\u91ca\u5668\u7684\u5916\u90e8\u6269\u5c55\uff0c\u5bfc\u5165\u6a21\u5757\u4ee5\u540e\u624d\u80fd\u751f\u6548\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5185\u7f6e\u51fd\u6570\u7684\u6267\u884c\u6548\u7387\u8981\u9ad8\u4e8e\u6807\u51c6\u5e93\u51fd\u6570\u3002<\/p>\n<p>Python \u89e3\u91ca\u5668\u4e00\u65e6\u542f\u52a8\uff0c\u6240\u6709\u7684\u5185\u7f6e\u51fd\u6570\u90fd\u751f\u6548\u4e86\uff1b\u800c\u5bfc\u5165\u6807\u51c6\u5e93\u7684\u67d0\u4e2a\u6a21\u5757\uff0c\u53ea\u662f\u8be5\u6a21\u5757\u4e0b\u7684\u51fd\u6570\u751f\u6548\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u6807\u51c6\u5e93\u51fd\u6570\u90fd\u751f\u6548\u3002<\/p>\n<p>\u5185\u7f6e\u51fd\u6570\u7684\u6570\u91cf\u5fc5\u987b\u88ab\u4e25\u683c\u63a7\u5236\uff0c\u5426\u5219 Python \u89e3\u91ca\u5668\u4f1a\u53d8\u5f97\u5e9e\u5927\u548c\u81c3\u80bf\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u53ea\u6709\u90a3\u4e9b\u4f7f\u7528\u9891\u7e41\u6216\u8005\u548c\u8bed\u8a00\u672c\u8eab\u7ed1\u5b9a\u6bd4\u8f83\u7d27\u5bc6\u7684\u51fd\u6570\uff0c\u624d\u4f1a\u88ab\u63d0\u5347\u4e3a\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5728\u5c4f\u5e55\u4e0a\u8f93\u51fa\u6587\u672c\u5c31\u662f\u4f7f\u7528\u6700\u9891\u7e41\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u6240\u4ee5 print() \u662f Python \u7684\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n<p>\u5728 Python 2.x \u4e2d\uff0cprint \u662f\u4e00\u4e2a\u5173\u952e\u5b57\uff1b\u5230\u4e86 Python 3.x \u4e2d\uff0cprint \u53d8\u6210\u4e86\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n<p>\u9664\u4e86 print() \u51fd\u6570\uff0cPython \u89e3\u91ca\u5668\u8fd8\u63d0\u4f9b\u4e86\u66f4\u591a\u5185\u7f6e\u51fd\u6570\uff0c\u4e0b\u8868\u5217\u51fa\u4e86 Python 3.x \u4e2d\u7684\u6240\u6709\u5185\u7f6e\u51fd\u6570\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5185\u7f6e\u51fd\u6570<\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>abs()<\/td>\n<td>delattr()<\/td>\n<td>hash()<\/td>\n<td>memoryview()<\/td>\n<td>set()<\/td>\n<\/tr>\n<tr>\n<td>all()<\/td>\n<td>dict()<\/td>\n<td>help()<\/td>\n<td>min()<\/td>\n<td>setattr()<\/td>\n<\/tr>\n<tr>\n<td>any()<\/td>\n<td>dir()<\/td>\n<td>hex()<\/td>\n<td>next()<\/td>\n<td>slicea()<\/td>\n<\/tr>\n<tr>\n<td>ascii()<\/td>\n<td>divmod()<\/td>\n<td>id()<\/td>\n<td>object()<\/td>\n<td>sorted()<\/td>\n<\/tr>\n<tr>\n<td>bin()<\/td>\n<td>enumerate()<\/td>\n<td>input()<\/td>\n<td>oct()<\/td>\n<td>staticmethod()<\/td>\n<\/tr>\n<tr>\n<td>bool()<\/td>\n<td>eval()<\/td>\n<td>int()<\/td>\n<td>open()<\/td>\n<td>str()<\/td>\n<\/tr>\n<tr>\n<td>breakpoint()<\/td>\n<td>exec()<\/td>\n<td>isinstance()<\/td>\n<td>ord()<\/td>\n<td>sum()<\/td>\n<\/tr>\n<tr>\n<td>bytearray()<\/td>\n<td>filter()<\/td>\n<td>issubclass()<\/td>\n<td>pow()<\/td>\n<td>super()<\/td>\n<\/tr>\n<tr>\n<td>bytes()<\/td>\n<td>float()<\/td>\n<td>iter()<\/td>\n<td>print()<\/td>\n<td>tuple()<\/td>\n<\/tr>\n<tr>\n<td>callable()<\/td>\n<td>format()<\/td>\n<td>len()<\/td>\n<td>property()<\/td>\n<td>type()<\/td>\n<\/tr>\n<tr>\n<td>chr()<\/td>\n<td>frozenset()<\/td>\n<td>list()<\/td>\n<td>range()<\/td>\n<td>vars()<\/td>\n<\/tr>\n<tr>\n<td>classmethod()<\/td>\n<td>getattr()<\/td>\n<td>locals()<\/td>\n<td>repr()<\/td>\n<td>zip()<\/td>\n<\/tr>\n<tr>\n<td>compile()<\/td>\n<td>globals()<\/td>\n<td>map()<\/td>\n<td>reversed()<\/td>\n<td><strong>import<\/strong>()<\/td>\n<\/tr>\n<tr>\n<td>complex()<\/td>\n<td>hasattr()<\/td>\n<td>max()<\/td>\n<td>round()<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8868 1 \u4e2d\u5404\u4e2a\u5185\u7f6e\u51fd\u6570\u7684\u5177\u4f53\u529f\u80fd\u548c\u7528\u6cd5\uff0c\u53ef\u901a\u8fc7\u8bbf\u95ee <a href=\"https:\/\/docs.python.org\/zh-cn\/3\/library\/functions.html\">https:\/\/docs.python.org\/zh-cn\/3\/library\/functions.html<\/a> \u8fdb\u884c\u67e5\u770b\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u4e0d\u8981\u4f7f\u7528\u5185\u7f6e\u51fd\u6570\u7684\u540d\u5b57\u4f5c\u4e3a\u6807\u8bc6\u7b26\u4f7f\u7528\uff08\u4f8b\u5982\u53d8\u91cf\u540d\u3001\u51fd\u6570\u540d\u3001\u7c7b\u540d\u3001\u6a21\u677f\u540d\u3001\u5bf9\u8c61\u540d\u7b49\uff09\uff0c\u867d\u7136\u8fd9\u6837\u505a Python \u89e3\u91ca\u5668\u4e0d\u4f1a\u62a5\u9519\uff0c\u4f46\u8fd9\u4f1a\u5bfc\u81f4\u540c\u540d\u7684\u5185\u7f6e\u51fd\u6570\u88ab\u8986\u76d6\uff0c\u4ece\u800c\u65e0\u6cd5\u4f7f\u7528\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>>&gt;&gt; print = &quot;http:\/\/c.biancheng.net\/python\/&quot;  #\u5c06print\u4f5c\u4e3a\u53d8\u91cf\u540d\n>&gt;&gt; print(&quot;Hello World!&quot;)  #print\u51fd\u6570\u88ab\u8986\u76d6\uff0c\u5931\u6548\nTraceback (most recent call last):\n  File &quot;&lt;pyshell#1&gt;&quot;, line 1, in &lt;module&gt;\n    print(&quot;Hello World!&quot;)\nTypeError: &#039;str&#039; object is not callable<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u6587\u6863\uff1ahttps:\/\/docs.python.org\/zh-cn\/3\/library\/functions.html \u89e3\u91ca\u5668\u81ea\u5e26\u7684\u51fd\u6570   \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[34],"tags":[159],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/8723"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8723"}],"version-history":[{"count":1,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/8723\/revisions"}],"predecessor-version":[{"id":8724,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/8723\/revisions\/8724"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8723"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}