{"id":561,"date":"2022-12-28T14:10:28","date_gmt":"2022-12-28T06:10:28","guid":{"rendered":"http:\/\/www.cyayaa.com\/?p=561"},"modified":"2022-12-28T14:10:28","modified_gmt":"2022-12-28T06:10:28","slug":"python%e5%8f%96%e5%87%ba%e5%ad%97%e5%85%b8%e4%b8%ad%e7%9a%84%e5%80%bc","status":"publish","type":"post","link":"http:\/\/www.cyayaa.com\/index.php\/2022\/12\/28\/python%e5%8f%96%e5%87%ba%e5%ad%97%e5%85%b8%e4%b8%ad%e7%9a%84%e5%80%bc\/","title":{"rendered":"Python\u53d6\u51fa\u5b57\u5178\u4e2d\u7684\u503c"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u95ee\u9898\uff1a<br>\u7528 list() \u51fd\u6570\u65b0\u5efa\u5217\u8868\u65f6\uff0c\u62a5\u9519 \u201cTypeError: \u2018list\u2019 object is not callable\u201d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u56e0\uff1a<br>\u4e00\u5f00\u59cb\u6211\u627e\u4e0d\u5230\u539f\u56e0\uff0c\u56e0\u4e3a\u6211\u7684\u4ee3\u7801\u548c\u4e66\u4e0a\u7684\u4f8b\u5b50\u662f\u4e00\u6a21\u4e00\u6837\u7684\uff0c\u4e3a\u4ec0\u4e48\u4f1a\u62a5\u9519\u5462\uff1f\u540e\u6765\u5728StackOverflow\u7684\u4e00\u4e2a\u95ee\u7b54 \u91cc\u627e\u5230\u4e86\u539f\u56e0\uff0c\u56e0\u4e3a\u4e4b\u524d\u7684\u4ee3\u7801\u628alist\u7528\u4e8e\u547d\u540d\u3002\u6211\u4e4b\u524d\u5728\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868\u65f6\u7528\u4e86list=[1,2,3]\uff0c\u540e\u6765\u89c9\u5f97\u4e0d\u59a5\uff0c\u8fd0\u884c\u8fd9\u884c\u4ee3\u7801\u4e4b\u540e\u53c8\u5220\u9664\u4e86\u3002\u4f46\u662f Jupyter Notebook \u662f\u4ea4\u4e92\u5f0f\u7f16\u8f91\u5668\uff0c\u9664\u975e\u91cd\u542fkernel\uff0c\u4e00\u65e6\u547d\u540d\uff0c\u8fd9\u4e2a\u53d8\u91cf\u5c31\u5360\u7528\u4e86\u5185\u5b58\u3002\u6240\u4ee5\uff0c\u540e\u9762\u8c03\u7528 list() \u51fd\u6570\u8fd0\u884c\u4ee3\u7801list1=list(range(10))\u65f6\uff0c\u7f16\u8bd1\u5668\u5c31\u628a\u5176\u4e2d\u7684list\u89e3\u91ca\u4e3a\u4e4b\u524d\u5b9a\u4e49\u8fc7\u7684\u5217\u8868[1,2,3]\uff0c\u7a0b\u5e8f\u8fd0\u884c\u51fa\u9519\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u89e3\u51b3\u65b9\u6cd5\uff1a<br>1.\u5343\u4e07\u4e0d\u8981\u7528 list\uff0ctuple \u7b49\u7b49 Python \u7684\u6570\u636e\u7c7b\u578b\u540d\u6765\u547d\u540d\u76f8\u5e94\u7684\u5bf9\u8c61\uff0c\u540c\u7406\uff0c\u4e0d\u8981\u7528 for, in \u8fd9\u4e9b\u5173\u952e\u8bcd\u547d\u540d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.\u6b64\u65f6\u53ef\u4ee5\u7528 del list\uff0c\u91ca\u653e\u53d8\u91cf list \u5360\u7528\u7684\u5185\u5b58\uff0c\u8fd9\u6837\u518d\u4f7f\u7528 list() \u51fd\u6570\u65f6\u5c31\u4f1a\u6b63\u786e\u89e3\u91ca\u3002\u540c\u65f6\u9700\u8981\u6ce8\u610f\uff0c\u4e4b\u524d\u5b9a\u4e49\u540d\u5b57\u4e3a list \u7684\u5217\u8868\u4e5f\u5df2\u7ecf\u4e0d\u5b58\u5728\u4e86\u3002\u800c\u5982\u679c\u5728 Jupyter Notebook \u9047\u5230\u548c\u6211\u7c7b\u4f3c\u7684\u60c5\u51b5\uff0c\u4e5f\u53ef\u4ee5\u91cd\u542fkernel\uff08\u4e5f\u662f\u5728\u91ca\u653e\u5185\u5b58\uff09\uff0c\u7136\u540e\u8fd0\u884c list() \u51fd\u6570\u6240\u5728\u4ee3\u7801\u5355\u5143\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9644\u6ce8\uff1a\u5728\u4e0a\u8ff0 StackOverflow \u7684\u56de\u7b54\u91cc\uff0c\u5927\u795e\u8fd8\u63d0\u5230\u4e86\u4e00\u79cd\u60c5\u51b5\uff0c\u6bd4\u5982\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u5217\u8868\uff1anums=[1,2,3]\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u8981\u7528nums[i]\u6765\u7d22\u5f15\u5143\u7d20\u3002\u800c\u5982\u679c\u7528nums(i)\uff0c\u4e5f\u4f1a\u62a5\u540c\u6837\u7684\u9519\u8bef\uff1a\u201cTypeError: \u2018list\u2019 object is not callable\u201d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\uff1a\u7528 list() \u51fd\u6570\u65b0\u5efa\u5217\u8868\u65f6\uff0c\u62a5\u9519 \u201cTypeError: \u2018list\u2019 object is not &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.cyayaa.com\/index.php\/2022\/12\/28\/python%e5%8f%96%e5%87%ba%e5%ad%97%e5%85%b8%e4%b8%ad%e7%9a%84%e5%80%bc\/\"> <span class=\"screen-reader-text\">Python\u53d6\u51fa\u5b57\u5178\u4e2d\u7684\u503c<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":1,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":563,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/posts\/561\/revisions\/563"}],"wp:attachment":[{"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cyayaa.com\/index.php\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}