{"id":185,"date":"2023-02-19T19:34:20","date_gmt":"2023-02-19T11:34:20","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=185"},"modified":"2023-02-19T19:35:12","modified_gmt":"2023-02-19T11:35:12","slug":"python-array-traversal","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/19\/python-array-traversal\/","title":{"rendered":"Python\u6570\u7ec4\u904d\u5386"},"content":{"rendered":"<p>Python\u6570\u7ec4\u904d\u5386\u65b9\u6cd5<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-python\"># -*- coding: utf-8 -*-\nif __name__ == &#039;__main__&#039;:\n    list = [&#039;Android&#039;, &#039;iOS&#039;, &#039;JavaScript&#039;, &#039;Python&#039;, &#039;PHP&#039;, &#039;Java&#039;]\n\n    # \u65b9\u6cd51\n    print(&#039;********** \u904d\u5386\u5217\u8868\u65b9\u6cd51 **********&#039;)\n    for i in list:\n        print(&quot;\u5e8f\u53f7: %s, \u503c: %s&quot; % (list.index(i) + 1, i))\n\n    print(&#039;\\n********** \u904d\u5386\u5217\u8868\u65b9\u6cd52 **********&#039;)\n    # \u65b9\u6cd52\n    for i in range(len(list)):\n        print(&quot;\u5e8f\u53f7: %s, \u503c: %s&quot; % (i + 1, list[i]))\n\n    # \u65b9\u6cd53\n    print(&#039;\\n********** \u904d\u5386\u5217\u8868\u65b9\u6cd53 **********&#039;)\n    for i, val in enumerate(list):\n        print(&quot;\u5e8f\u53f7: %s, \u503c: %s&quot; % (i + 1, val))\n\n    # \u65b9\u6cd53\n    print(&#039;\\n********** \u904d\u5386\u5217\u8868\u65b9\u6cd53(\u8bbe\u7f6e\u904d\u5386\u5f00\u59cb\u521d\u59cb\u4f4d\u7f6e, \u53ea\u6539\u53d8\u4e86\u8d77\u59cb\u5e8f\u53f7) **********&#039;)\n    for i, val in enumerate(list, 2):\n        print(&quot;\u5e8f\u53f7: %s, \u503c: %s&quot; % (i + 1, val))\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Python\u6570\u7ec4\u904d\u5386\u65b9\u6cd5 # -*- coding: utf-8 -*- if __name__ == &#038;#0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[79],"tags":[],"class_list":["post-185","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=185"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/185\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}