{"id":1396,"date":"2020-08-25T15:53:11","date_gmt":"2020-08-25T07:53:11","guid":{"rendered":"http:\/\/localhost\/wordpress\/?p=1396"},"modified":"2020-08-25T15:53:11","modified_gmt":"2020-08-25T07:53:11","slug":"python","status":"publish","type":"post","link":"https:\/\/blog.xukzhao.dpdns.org\/?p=1396","title":{"rendered":"python"},"content":{"rendered":"\n<p>&#8221;&#8217;<br>\u4f7f\u7528\u4e09\u4e2a\u5355\u5f15\u53f7\u6216\u53cc\u5f15\u53f7\u5f53\u4f5c\u6ce8\u91ca<\/p>\n\n\n\n<p># \u4e3a\u5355\u884c\u6ce8\u91ca<\/p>\n\n\n\n<p>&#8221;&#8217;<\/p>\n\n\n\n<!--more-->\n\n\n\n<h5 class=\"wp-block-heading\">\u8ba4\u8bc6\u53d8\u91cf\u4e0e\u57fa\u672c\u6570\u5b66\u8fd0\u7b97<\/h5>\n\n\n\n<p>y1 = 125*3\/2   # \u8fd0\u7b97\u4f18\u5148\u7ea7\uff1a1\u6b21\u65b9&gt;&gt;2\u4e58\u9664\u6c42\u4f59\u6c42\u6574&gt;&gt;3\u52a0\u51cf<br>y2 = 9 % 5      # \u5c069\u9664\u4ee55\u7684\u4f59\u6570\u7ed9\u53d8\u91cf<br>y2 = 9 \/\/ 2      # \u5c069\u9664\u4ee52\u7684\u6574\u6570\u7ed9\u53d8\u91cf<br>y3 = 3 ** 3     # \u5c063\u76843\u6b21\u65b9\u7ed9\u53d8\u91cf<br><br>a += b         # a = a+b<br>a -= b          # a = a-b<br>a *= b           # a = a*b<br>a \/= b         # a = a\/b<br>a %= b        # a = a%b<br>a \/\/= b       # a = a\/\/b<br>a** = b         # a = a**b<\/p>\n\n\n\n<p>x = y = z =10    # \u591a\u91cd\u6307\u5b9a<br>x,y,z = 10,20,30 # \u591a\u53d8\u91cf\u4e0d\u540c\u503c<br>x,y = y,x            # \u53d8\u91cf\u4ea4\u6362<br>del y1               # \u5220\u9664\u53d8\u91cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> #\u957f\u8bed\u53e5\u5206\u884c\u65b9\u5f0f\uff1a\\\u6216\u62ec\u53f7\n   x =  y+\\\n        z\n   y = ( x+   #\u62ec\u53f7\u65b9\u5f0f\u53ef\u4ee5\u52a0\u6279\u6ce8\n         z)<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/h5>\n\n\n\n<p># type()\u51fd\u6570 \u5217\u51fa\u53d8\u91cf\u7c7b\u578b\uff1a\u6574\u6570\uff08int\uff09,\u6d6e\u70b9\u6570\uff08float\uff09,\u5e03\u5c14\u503c\uff08Boolean\uff09,\u5b57\u7b26\u4e32\uff08string\uff09<br>   print(type(x))<\/p>\n\n\n\n<p><br>#\u6570\u503c\u6570\u636e\u7c7b\u578b<br>   # 2\u8fdb\u4f4d\u6574\u6570(0b\u5f00\u5934\u7684\u6570\u5b57)\u4e0e\u51fd\u6570 bin():\u5c06\u4e00\u822c\u6570\u5b57\u8f6c\u6362\u4e3a2\u8fdb       \u4f4d<br>   # 8\u8fdb\u4f4d\u6574\u6570(0o\u5f00\u5934\u7684\u6570\u5b57)\u4e0e\u51fd\u6570 oct():\u5c0610\u8fdb\u4f4d\u6570\u503c\u8f6c\u6362\u4e3a8\u8fdb\u4f4d<br>   # 16\u8fdb\u4f4d\u6574\u6570(0x\u5f00\u5934\u7684\u6570\u5b57)\u4e0e\u51fd\u6570 hex():\u5c06\u4e00\u822c\u6570\u5b57\u8f6c\u6362\u4e3a16\u8fdb\u4f4d<br>   # \u5f3a\u5236\u6570\u636e\u7c7b\u578b\u7684\u8f6c\u6362\uff1aint()\u5c06\u6570\u636e\u7c7b\u578b\u5f3a\u5236\u8f6c\u6362\u4e3a\u6574\u6570\u3001float()\u5c06\u6570\u636e\u7c7b\u578b\u5f3a\u5236\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570<\/p>\n\n\n\n<p><br>#\u6570\u503c\u8fd0\u7b97\u5e38\u7528\u7684\u51fd\u6570<br>   # abs():\u8ba1\u7b97\u7edd\u5bf9\u503c<br>   # pow(x,y)\uff1a\u8fd4\u56dex\u7684y\u6b21\u65b9<br>   # round()\uff1a\u8fd4\u56de\u4e94\u820d\u516d\u5165<\/p>\n\n\n\n<p><br>#\u5e03\u5c14\u503c\u6570\u636e\u7c7b\u578b:True\u6216False,\u6570\u636e\u4ee3\u53f7\u662fbool<\/p>\n\n\n\n<p><br>#\u5b57\u7b26\u4e32\u6570\u636e\u7c7b\u578b\uff1a\u4e24\u4e2a\u5355\u5f15\u53f7\u6216\u53cc\u5f15\u53f7\u4e4b\u95f4\u7684\u4efb\u610f\u4e2a\u6570\u5b57\u5143\u7b26\u53f7\u7684\u6570\u636e\uff0c\u4ee3\u53f7\u662fstr<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>   # \u5b57\u7b26\u4e32\u7684\u8fde\u63a5\uff1a\u6570\u5b66\u8fd0\u7b97\u7b26\u201d+\u201c<\/p>\n\n\n\n<p>   # \u5904\u7406\u591a\u4e8e\u4e00\u884c\u7684\u5b57\u7b26\u4e32\uff1a\u53ef\u4ee5\u4f7f\u7528\u4e09\u4e2a\u5f15\u53f7\u5c06\u5b57\u7b26\u4e32\u5305\u5939<\/p>\n\n\n\n<p>   # \u9038\u51fa\u5b57\u7b26\uff1a\u5982\u679c\u5b57\u7b26\u4e32\u5185\u6709\u4e00\u4e9b\u7279\u6b8a\u5b57\u7b26\uff0c\u5fc5\u987b\u5728\u6b64\u7279\u6b8a\u5b57\u7b26\u524d\u52a0\u201d\\\u201c<\/p>\n\n\n\n<p>   # \\&#8217; \u5355\u5f15\u53f7\uff1b\\&#8221; \u53cc\u5f15\u53f7\uff1b\\ \u53cd\u659c\u6760\uff1b\\a \u54cd\u94c3\uff1b\\b BackSpace\u952e\uff1b\\f \u6362\u9875\uff1b<\/p>\n\n\n\n<p>   # \\n \u6362\u884c\uff1b\\o \u516b\u8fdb\u5236\u8868\u793a\uff1b\\r \u5149\u6807\u79fb\u81f3\u6700\u5de6\u4f4d\u7f6e\uff1b\\x \u5341\u516d\u8fdb\u4f4d\u8868\u793a\uff1b\\t Tab\u952e\u6548\u679c\uff1b\\v \u5782\u76f4\u5b9a\u4f4d<\/p>\n\n\n\n<p>   # str()\u5f3a\u5236\u5c06\u6570\u503c\u6570\u636e\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u6570\u636e<\/p>\n\n\n\n<p>   # int()\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6574\u6570<\/p>\n\n\n\n<p>   # \u5b57\u7b26\u4e32\u6570\u636e\u7684\u8f6c\u6362<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8221;&#8217;\u4f7f\u7528\u4e09\u4e2a\u5355\u5f15\u53f7\u6216\u53cc\u5f15\u53f7\u5f53\u4f5c\u6ce8\u91ca # \u4e3a\u5355\u884c\u6ce8\u91ca &#8221;&#8217;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"templates\/template-full-width.php","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-1396","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/1396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1396"}],"version-history":[{"count":0,"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/1396\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xukzhao.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}