{"id":64,"date":"2016-01-12T15:45:42","date_gmt":"2016-01-12T15:45:42","guid":{"rendered":"http:\/\/yellingstone.info\/?p=64"},"modified":"2016-04-13T00:19:46","modified_gmt":"2016-04-12T22:19:46","slug":"%e6%a0%b8%e5%bf%83%e8%af%ad%e8%a8%80%e5%ad%a6%e6%97%a0%e7%bc%96%e7%a8%8b%e5%9f%ba%e7%a1%80%e5%85%a5%e9%97%a8python%ef%bc%88%e7%ac%ac%e4%b8%80%e7%ab%a0%ef%bc%89","status":"publish","type":"post","link":"http:\/\/yellingstone.info\/?p=64","title":{"rendered":"\u6838\u5fc3\u8bed\u8a00\u5b66\u65e0\u7f16\u7a0b\u57fa\u7840\u5165\u95e8Python\uff08\u7b2c\u4e00\u7ae0\uff09"},"content":{"rendered":"<p>\u57fa\u672c\u662f\u79c1\u4eba\u7b14\u8bb0\u3002\u7f16\u7a0b\u57fa\u78400\uff0c\u8ba1\u7b97\u673a\u8bed\u8a00\u5b66\u3001\u8bed\u6599\u5e93\u8bed\u8a00\u5b66\u548c\u81ea\u5df1\u5c31\u8bfb\u7684\u4e13\u4e1a\u8054\u7cfb\u5f88\u5c11\u3002\u53e6\u5916\u672c\u7cfb\u5217\u5df2\u7ecf\u5b8c\u7ed3\u4e86\uff0c\u4e00\u5171\u662f\u516d\u7ae0\u3002<!--more--><\/p>\n<p>\u5047\u8bbe\u5df2\u7ecf<a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\">\u5b89\u88c5\u597d\u4e86Python<\/a>\u3002\u542c\u8bf4Python\u662f\u67092.x\u548c3.x\u7684\u533a\u522b\u7684\uff0c\u4f46\u662f\u6211\u7684\u4e13\u4e1a\u5f88\u843d\u540e\uff0c\u6211\u9009\u62e9\u4e862.x\u3002\u5e76\u4e14\u542c\u8bf4Python\u5728Mac\u673a\u4e0a\u662f\u9884\u88c5\u597d\u4e86\u7684\uff0c\u4f46\u662f\u6211\u8fd8\u662f\u5f88\u843d\u540e\uff0c\u5bb6\u91cc\u53ea\u6709PC\u673a\u3002<\/p>\n<p>\u4f46\u662f\u6700\u8d77\u7801\u7684\u7406\u667a\u6211\u8fd8\u662f\u6709\u7684\u3002\u3010\u811a\u672c\u6700\u597d\u5355\u72ec\u5b58\u6210\u4e00\u4e2a.py\u6587\u4ef6\u3011\uff0c\u800c\u4e0d\u662f\u8fdb\u5165Python\u4e4b\u540e\uff0c\u5728\u5185\u5b58\u91cc\u9762\u4e00\u884c\u4e00\u884c\u4ee3\u7801\u7136\u540e\u56de\u8f66\u3002<\/p>\n<p>\u8fd0\u884c\u4e00\u4e2a\u811a\u672c\u7684\u65b9\u6cd5\u662f\u5728\u547d\u4ee4\u884c\u91cc\u5199  python 1.py \u7136\u540e\u56de\u8f66\uff08\u5047\u8bbe\u5b58\u7684\u811a\u672c\u6587\u4ef6\u53eb 1.py\uff09<\/p>\n<hr>\n<p>1 \u548cPython\u597d\u597d\u8c08\u4e00\u8c08\uff08print\uff09<\/p>\n<p>\u65e2\u7136\u6ca1\u6709\u7f16\u7a0b\u57fa\u7840\uff0c\u6700\u57fa\u672c\u3001\u6700\u60f3\u5165\u624b\u7684\u4e8b\u60c5\u5c31\u662f\u3010\u544a\u8bc9Python\u4e00\u4ef6\u4e8b\uff0c\u7136\u540e\u8ba9Python\u9a6c\u4e0a\u628a\u8fd9\u4ef6\u4e8b\u590d\u8ff0\u4e00\u904d\u3011\uff0c\u8981\u7528\u5230print\u8fd9\u4e2a\u547d\u4ee4\u3002\u57fa\u672c\u7684\u7528\u6cd5\u5c31\u662f<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint \u3010\u67d0\u4e2a\u4e1c\u897f\u3011<br \/>\n[\/code]<\/p>\n<p>\uff08\u8bf7\u5c1d\u8bd5\u4e4b\u524d\u5148\u628a\u811a\u672c\u5b58\u62101.py\uff0c\u7136\u540e\u5728\u547d\u4ee4\u884c\u91cc\u4f7f\u7528python 1.py\u8c03\u7528\uff09<\/p>\n<p>\u8fd9\u91cc\u8bf4\u7684\u300c\u67d0\u4e2a\u4e1c\u897f\u300d\u5176\u5b9e\u6709\u86ee\u591a\u79cd\u7c7b\u7684\uff0c\u4e0d\u8fc7\u73b0\u5728\u8fd9\u4e2a\u9636\u6bb5\u4e5f\u4e0d\u662f\u592a\u91cd\u8981\uff0c\u73b0\u5728\u53ea\u8981\u8bb0\u4f4f\u53ef\u4ee5print\u7684\u5bf9\u8c61\u53ef\u4ee5\u662f\u3010\u5b57\u4e32\/string\uff08\u67d0\u4e2a\u5355\u8bcd\uff1f\uff09\u3011\u548c\u3010\u6570\u5b57\/number\uff08\u53ef\u4ee5\u52a0\u51cf\u4e58\u9664\uff1f\uff09\u3011\u5c31\u597d\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint &quot;Python is easy&quot;<br \/>\n# =&gt; Python is easy<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint 1<br \/>\n# =&gt; 1<br \/>\n[\/code]<\/p>\n<p>\u6709\u4e24\u4e2a\u70b9\u8981\u5343\u4e07\u8bb0\u4f4f\uff0c\u7b2c\u4e00\u4e2a\u662f\u5b57\u4e32\u8981\u7528\u5f15\u53f7\u6846\u8d77\u6765\uff08\u5355\u5f15\u53f7\u53cc\u5f15\u53f7\u5012\u65e0\u6240\u8c13\uff0c\u4f46\u4f60\u81f3\u5c11\u8981\u7528\u4e00\u5bf9\uff09\uff0c\u7b2c\u4e8c\u4e2a\u662f\u770b\u4e0a\u53bb\u662f\u6570\u5b57\u7684\u4e1c\u897f\u5f53\u7136\u4e5f\u53ef\u80fd\u662f\u5b57\u4e32\uff0c\u4f46\u662f\u4f60print\u7684\u65f6\u5019\u81f3\u5c11\u8981\u544a\u8bc9Python\uff0c\u6211\u8981\u7684\u662f\u5b57\u4e32\u76841\uff0c\u800c\u4e0d\u662f\u6570\u5b57\u76841\uff0c\u6bd4\u5982\u4e0b\u9762\u8fd9\u4e00\u884c\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint &quot;1&quot;<br \/>\n# =&gt; 1<br \/>\n[\/code]<\/p>\n<p>\u4f30\u8ba1\u6709\u4eba\u5acc\u70e6\u4e86\uff0c\u5fc3\u60f3\u4e3a\u4ec0\u4e48\u4e00\u5b9a\u8981\u533a\u5206\u5b57\u4e32\u548c\u6570\u5b57\u5462\u3002\u90a3\u662f\u56e0\u4e3aPython\u5728\u8fd0\u7b97\u7684\u65f6\u5019\u5904\u7406\u5b57\u4e32\uff08string\uff09\u548c\u6570\u5b57\uff08number\uff09\u662f\u4e0d\u4e00\u6837\u7684\uff1a\u4e24\u4e2a\u5b57\u4e32\u52a0\u5728\u4e00\u8d77\u4f1a\u53d8\u6210\u4e00\u4e2a\u957f\u7684\u5b57\u4e32\uff0c\u4e24\u4e2a\u6570\u5b57\u52a0\u5728\u4e00\u8d77\u7ed3\u679c\u8981\u95ee\u5c0f\u5b66\u6570\u5b66\u8001\u5e08\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint &quot;1&quot; + &quot;1&quot;<br \/>\n# =&gt; 11<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\nprint &quot;1&quot; + &quot;1&quot;<br \/>\n# =&gt; 2<br \/>\n[\/code]<\/p>\n<p>\u5177\u4f53\u9664\u4e86+\u4ee5\u5916\u8fd8\u5141\u8bb8\u4ec0\u4e48\u8fd0\u7b97\u65b9\u5f0f\u8bf7\u81ea\u5df1\u641c\u5176\u4ed6\u7684\u6559\u7a0b\u2026<\/p>\n<hr>\n<p>2 Python\u4f60\u5e2e\u6211\u7701\u7701\u5fc3\u554a\uff08=\uff09<\/p>\n<p>print\u6bd5\u7adf\u8fd8\u662f\u86ee\u8822\u7684\uff0c\u4f60\u544a\u8bc9\u5b83\u4ec0\u4e48\uff0c\u5b83\u9a6c\u4e0a\u5c31\u505a\u4ec0\u4e48\u3002\u6709\u4e9b\u65f6\u5019\u6211\u3010\u5e0c\u671bPython\u80fd\u5148\u8bb0\u4f4f\u4e00\u4e9b\u4e8b\u60c5\u3011\uff0c\u6211\u9700\u8981\u7684\u65f6\u5019\u518d\u8ba9\u5b83\u544a\u8bc9\u6211\u3002\u8fd9\u4e2a\u65f6\u5019\u5c31\u8981\u7528\u5230=\u3002\u800c\u4e14\u6211\u5f97\u627e\u4e2a\u5730\u65b9\u8ba9Python\u628a\u67d0\u4ef6\u4e8b\u60c5\u8bb0\u4e0b\u6765\uff0c\u627e\u7684\u5730\u65b9\u8981\u5199\u5728=\u524d\u9762\uff0c\u7528\u6cd5\u5982\u4e0b<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\na=&quot;so easy&quot;<br \/>\n[\/code]<\/p>\n<p>\u8fd9\u91cc\u6211\u5c31\u628aso easy\u8fd9\u4e2a\u5b57\u4e32\uff08\u5176\u5b9e\u662f&#8221;so easy&#8221;\uff09\u5b58\u8fdba\u8fd9\u4e2a\u53d8\u91cf\u91cc\u4e86\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u88ab\u79f0\u4e3a\u3010\u8d4b\u503c\u3011\uff08\u4ee5\u540e\u8fd9\u4e2a\u8bcd\u4f30\u8ba1\u4f1a\u7ecf\u5e38\u542c\u5230\uff09\u3002\u53d8\u91cf\u7684\u540d\u5b57\uff08\u6bd4\u5982\u8fd9\u91cc\u7684a\uff09\u662f\u5927\u5bb6\u968f\u4fbf\u9009\u7684\uff0c\u5b8c\u5168\u770b\u4e2a\u4eba\u7684\u683c\u8c03\uff0c\u53ea\u8981\u548cPython\u7cfb\u7edf\u5df2\u7ecf\u5206\u914d\u7684\u4e00\u4e9b\u4e0d\u8d77\u51b2\u7a81\u5c31\u884c\u4e86\uff08\u5b9e\u9645\u4e0a\u56e0\u4e3a\u4e2a\u4eba\u54c1\u5473\u5343\u5dee\u4e07\u522b\uff0c\u8d77\u51b2\u7a81\u7684\u53ef\u80fd\u6027\u771f\u5f97\u5f88\u4f4e\uff09\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c\u5149\u662f\u5b58\u4e0b\u4e00\u4e2a\u53d8\u91cf\uff08\u8d4b\u503c\uff09\uff0c\u7cfb\u7edf\u4e5f\u6ca1\u4ec0\u4e48\u76f4\u63a5\u7684\u53cd\u9988\uff0c\u5982\u679c\u60f3\u786e\u8ba4\u81ea\u5df1\u5b58\u4e86\u4ec0\u4e48\uff0c\u8fd8\u662f\u8981\u7528\u524d\u9762\u8bf4\u8fc7\u7684print\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\na=&quot;so easy&quot;<br \/>\nprint a<br \/>\n# =&gt; so easy<br \/>\n[\/code]<\/p>\n<p>\uff08\u518d\u8bf4\u4e00\u6b21\uff0c\u5c1d\u8bd5\u4e4b\u524d\u5148\u628a\u811a\u672c\u5b58\u62101.py\uff0c\u7136\u540e\u5728\u547d\u4ee4\u884c\u91cc\u4f7f\u7528python 1.py\u8c03\u7528\uff09<\/p>\n<p>\u7528= \u8fdb\u884c\u8d4b\u503c\u7684\u65f6\u5019\uff0c\u4e5f\u662f\u80fd\u8fdb\u884c\u8fd0\u7b97\u7684\uff0c\u8fd9\u6837\u5c31\u80fd\u7701\u4e0b print \u8fd9\u4e00\u884c\u4e0d\u5c11\u7684\u7bc7\u5e45\u4e86\u3002\u6bd4\u5982\u4e0a\u9762\u63d0\u5230\uff1a print &#8220;1&#8221; + &#8220;1&#8221; \u7684\u7ed3\u679c\u662f 11\uff08\u5176\u5b9e\u662f&#8221;11&#8243;\uff09\uff0c\u6211\u4eec\u4e5f\u80fd\u6362\u4e2a\u6cd5\u5b50\u505a\u8fd9\u4e2a\u8fd0\u7b97<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\n# \u811a\u672c1\uff1a<br \/>\na=&quot;1&quot;<br \/>\nb=&quot;1&quot;<br \/>\nc=a+b<br \/>\nprint c<br \/>\n# =&gt; 11<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\n# \u811a\u672c2\uff1a<br \/>\na=&quot;Python &quot;<br \/>\nb=&quot;so &quot;<br \/>\nc=&quot;easy&quot;<br \/>\nd=a+b+c<br \/>\nprint d<br \/>\n# =&gt; Python so easy<br \/>\n[\/code]<\/p>\n<p>\u6ce8\u610f\u811a\u672c2\u91cc\u9762a\u548cb\u6211\u5728\u540e\u9762\u90fd\u52a0\u4e86\u4e00\u4e2a\u7a7a\u683c\u54e6\uff0c\u5426\u5219print\u51fa\u6765\u7684\u4e1c\u897f\u662f\u4e09\u4e2a\u8bcd\u76f4\u63a5\u8d34\u5728\u4e00\u8d77\u3002\u5f53\u7136\u52a0\u7a7a\u683c\u8fd9\u79cd\u5de5\u4f5c\u4e5f\u53ef\u4ee5\u653e\u5728print\u91cc\u6765\u5b8c\u6210\uff0c\u4e3b\u8981\u8fd8\u662f\u770b\u6c14\u8d28\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\n# \u811a\u672c3\uff1a<br \/>\na=&quot;Python&quot;<br \/>\nb=&quot;so&quot;<br \/>\nc=&quot;easy&quot;<br \/>\nprint a+&quot; &quot;+b+&quot; &quot;+c<br \/>\n# =&gt; Python so easy<br \/>\n[\/code]<\/p>\n<p>\u5bf9\u4e86\uff0c=\u4e5f\u80fd\u5e2e\u7740\u8ba91\u8fd9\u79cd\u4e1c\u897f\u5728\u6570\u5b57\uff08number\uff09\u548c\u5b57\u4e32\uff08string\uff09\u4e4b\u95f4\u4e92\u76f8\u8f6c\u6362\u4e00\u4e0b\uff1a\u8f6c\u6210\u5b57\u4e32\u7528str()\uff0c\u8f6c\u6210\u6570\u5b57\u7528int()\u3002\u53e6\uff1a\u4e0d\u662f\u8868\u8fbe\u6574\u6570\u7684\u5b57\u4e32\u4f46\u8fd8\u662f\u60f3\u8f6c\u6570\u5b57\u7684\u8bdd\u7528float()\u3002\u81ea\u5df1\u8fd0\u884c\u4e00\u4e0b\u811a\u672c4\u548c\u811a\u672c5\uff0c\u5927\u6982\u5c31\u61c2\u4e86\u3002<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\n# \u811a\u672c4\uff1a<br \/>\na=2<br \/>\nb=str(a)<br \/>\nc=&quot;016&quot;<br \/>\nprint b+c<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;python&#8221;]<br \/>\n# \u811a\u672c5\uff1a<br \/>\na=&quot;2&quot;<br \/>\nb=int(a)<br \/>\nc=2014<br \/>\nprint b+c<br \/>\n[\/code]<\/p>\n<hr>\n<p>\u5c0f\u6284\uff1aprint + = str(\u67d0\u6570\u5b57) int(\u67d0\u5b57\u4e32)\uff0c\u55ef\uff1f&#8221;&#8221;\u662f\u4ec0\u4e48\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u672c\u662f\u79c1\u4eba\u7b14\u8bb0\u3002\u7f16\u7a0b\u57fa\u78400\uff0c\u8ba1\u7b97\u673a\u8bed\u8a00\u5b66\u3001\u8bed\u6599\u5e93\u8bed\u8a00\u5b66\u548c\u81ea\u5df1\u5c31\u8bfb\u7684\u4e13\u4e1a\u8054\u7cfb\u5f88\u5c11\u3002\u53e6\u5916\u672c\u7cfb\u5217\u5df2\u7ecf\u5b8c\u7ed3\u4e86\uff0c\u4e00\u5171\u662f\u516d\u7ae0\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/yellingstone.info\/index.php?rest_route=\/wp\/v2\/posts\/64"}],"collection":[{"href":"http:\/\/yellingstone.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yellingstone.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yellingstone.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yellingstone.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64"}],"version-history":[{"count":0,"href":"http:\/\/yellingstone.info\/index.php?rest_route=\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"http:\/\/yellingstone.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yellingstone.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yellingstone.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}