{"id":837,"date":"2018-07-17T17:31:00","date_gmt":"2018-07-17T09:31:00","guid":{"rendered":"http:\/\/www.sniper97.cn\/?p=837"},"modified":"2018-07-17T17:31:00","modified_gmt":"2018-07-17T09:31:00","slug":"%e7%ac%ac%e4%b8%80%e8%ae%b2%ef%bc%9a%e5%9f%ba%e7%a1%80%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"http:\/\/www.sniper97.cn\/index.php\/note\/python\/837\/","title":{"rendered":"\u7b2c\u4e00\u8bb2\uff1a\u57fa\u7840\u6570\u636e\u7c7b\u578b"},"content":{"rendered":"<p>&nbsp;<br \/>\n&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\"># -*- coding:UTF-8 -*-\n# \u53d8\u91cf\ns = 'Hello World'\nprint(s)\nprint(s[5:])\nprint(s[:4])\n# s[2:]\n# print\n# s * 2\n# print\n# s + \" TEST\"\n#\n# # \u5217\u8868 \/\/\u53ef\u53d8\u7684\u6570\u636e\u7ed3\u6784\n# list_a = [\"str\", 1, [\"a\", \"b\", \"c\"], 4]\n# list_b = [\"hello\"]\n#\n# print\n# list_a\n# list_a = [\"str\", 1, [\"a\", \"b\", \"c\"], 3] # \u53ef\u53d8\u7684\u6570\u636e\u7ed3\u6784\n# print\n# list_a\n# print\n# list_a[1:3]\n# print\n# list_a[1:]\n# print\n# list_b * 2\n# print\n# list_a + list_b\n#\n# # \u5143\u7ec4 \/\/\u4e0d\u53ef\u53d8\u7684\u6570\u636e\u7ed3\u6784(\u7c7b\u4f3c string \u8d4b\u503c\u64cd\u4f5c\u4ea7\u751f\u65b0\u7a7a\u95f4\n# tuple_a = (\"str\", 1, [\"a\", \"b\", \"c\"], 4)\n# tuple_b = (\"hello\",)\n#\n# print\n# tuple_a\n# tuple_a = (\"str\", 1, [\"a\", \"b\", \"c\"], \"123\")\n# print\n# tuple_a\n# tuple_a = (1, \"str\", [\"a\", \"b\", \"c\"])\n# print\n# tuple_a\n# print\n# tuple_a[1:3]\n# print\n# print(tuple_a[:])\n# tuple_b * 2\n# print\n# tuple_a + tuple_b\n# \u5b57\u5178 \u7c7b\u4f3c\u4e8emap&lt;a,b&gt;.\ndict_a = {\n\"name\": \"Alan\",\n\"age\": 24,\n1: \"level_1\"\n}\nprint(\"nownownownownownowo\")\nprint(dict_a[\"name\"])\nprint(dict_a[\"age\"])\nprint(dict_a[1])\nprint(\"name\" in dict_a) # name\u662f\u5426\u5b58\u5728key\u4e2d\nprint(\"xxx\" in dict_a) # -----------------\nprint(dict_a.keys()) # \u8fd4\u56de\u6240\u6709\u7684\u7d22\u5f15\nprint(dict_a.values()) # \u8fd4\u56de\u6240\u6709\u7684\u503c\nprint(dict_a.items()) # \u8fd4\u56de\u6240\u6709\u7684\uff08\u65e0\u5e8f\uff09\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; # -*- coding:UTF-8 -*- # \u53d8\u91cf s = &#8216;Hel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[24],"tags":[],"views":2329,"_links":{"self":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/837"}],"collection":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/comments?post=837"}],"version-history":[{"count":0,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/837\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/media?parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/categories?post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/tags?post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}