

{"id":104,"date":"2021-06-21T19:10:30","date_gmt":"2021-06-21T11:10:30","guid":{"rendered":"https:\/\/www.52dixiaowo.com\/python\/?p=104"},"modified":"2021-06-21T19:10:30","modified_gmt":"2021-06-21T11:10:30","slug":"python%e7%9a%84%e7%b1%bb%e5%b1%9e%e6%80%a7-%e7%b1%bb%e6%96%b9%e6%b3%95-%e9%9d%99%e6%80%81%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.52dixiaowo.com\/python\/post-104.html","title":{"rendered":"python\u7684\u7c7b\u5c5e\u6027, \u7c7b\u65b9\u6cd5, \u9759\u6001\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u5728python\u9762\u5411\u5bf9\u8c61\u4e2d, \u67092\u79cd\u5c5e\u6027<\/p>\n\n\n\n<ul><li>\u7c7b\u5c5e\u6027<\/li><li>\u5bf9\u8c61\u5c5e\u6027<\/li><\/ul>\n\n\n\n<p>\u7c7b\u5c5e\u6027, \u6307\u7684\u662f\u5c5e\u4e8e\u6b64\u7c7b\u7684\u591a\u4e2a\u5bf9\u8c61\u5171\u4eab\u8fd9\u4e9b\u53d8\u91cf<\/p>\n\n\n\n<p>\u6b64\u5916, \u67093\u79cd\u65b9\u6cd5<\/p>\n\n\n\n<ul><li>\u5bf9\u8c61\u65b9\u6cd5<\/li><li>\u7c7b\u65b9\u6cd5<\/li><li>\u9759\u6001\u65b9\u6cd5<\/li><\/ul>\n\n\n\n<p>\u7c7b\u65b9\u6cd5\u4e5f\u662f\u6307\u5c5e\u4e8e\u6b64\u7c7b\u7684\u6240\u6709\u5bf9\u8c61\u5171\u4eab\u4f7f\u7528, \u9759\u6001\u65b9\u6cd5\u548c\u7c7b\u65b9\u6cd5\u6709\u5c11\u91cf\u533a\u522b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Tool(object):\n\n    count = 0   #\u7c7b\u5c5e\u6027\n\n    def __init__(self, name=\"\"):\n        Tool.count += 1\n\n    @classmethod   #\u6b64\u6ce8\u89e3\u8868\u793a\u7c7b\u65b9\u6cd5\n    def sub_count(cls):\n\n        cls.show_help()  #\u8bbf\u95ee\u9759\u6001\u65b9\u6cd5\n        cls.count -= 1   #\u8bbf\u95ee\u7c7b\u5c5e\u6027\n        cls.show_test()  #\u8bbf\u95ee\u7c7b\u65b9\u6cd5\n\n    @classmethod\n    def sub_test(cls):\n        print(\"\u53e6\u4e00\u4e2a\u7c7b\u65b9\u6cd5\")\n\n\n    @staticmethod   #\u6b64\u6ce8\u89e3\u8868\u793a\u9759\u6001\u65b9\u6cd5\n    def show_help():\n        Tool.show_test()    #\u8bbf\u95ee\u9759\u6001\u65b9\u6cd5\n        # cls.sub_count()    #\u65e0\u6cd5\u8bbf\u95ee\u7c7b\u65b9\u6cd5\n        print(\"\u4e00\u4e2a\u9759\u6001\u65b9\u6cd5\")\n\n    @staticmethod\n    def show_test():\n        print(\"\u53e6\u4e00\u4e2a\u9759\u6001\u65b9\u6cd5\")\n\n\ntool1 = Tool()\ntool2 = Tool()\ntool3 = Tool()\n\nprint(tool1.count)  #\u82e5\u65e0\u540c\u540d\u5bf9\u8c61\u5c5e\u6027, \u5c06\u8f93\u51fa\u7c7b\u5c5e\u6027\nprint(Tool.count)  #\u8f93\u51fa\u7684\u662f\u7c7b\u5c5e\u6027\n\nTool.sub_count()   #\u8c03\u7528\u7c7b\u65b9\u6cd5, \u4e0d\u80fd\u8bbf\u95ee\u5bf9\u8c61\u5c5e\u6027\u65b9\u6cd5, \u80fd\u8bbf\u95ee\u7c7b\u5c5e\u6027, \u80fd\u8bbf\u95ee\u9759\u6001\u65b9\u6cd5\n\nTool.show_help()  #\u8c03\u7528\u9759\u6001\u65b9\u6cd5, \u5b83\u4e0d\u80fd\u8bbf\u95ee\u5bf9\u8c61\u5c5e\u6027, \u4e5f\u4e0d\u80fd\u8bbf\u95ee\u7c7b\u5c5e\u6027<\/code><\/pre>\n\n\n\n<p>\u65e0\u8bba\u662f\u7c7b\u65b9\u6cd5, \u8fd8\u662f\u9759\u6001\u65b9\u6cd5, \u5747\u4f7f\u7528\u4f7f\u7528\u4ee5\u4e0b\u65b9\u5f0f\u83b7\u53d6\u5c5e\u6027, \u8bbe\u7f6e\u503c\u4ec5\u80fd\u7528\u540e\u8005<\/p>\n\n\n\n<ul><li>\u5bf9\u8c61\u540d.\u65b9\u6cd5\u540d()   &#8212;&#8212;&#8211; \u4ec5\u9650\u65e0\u5bf9\u8c61\u65b9\u6cd5\u91cd\u540d, <\/li><li>\u7c7b\u540d.\u65b9\u6cd5\u540d()    &#8212;&#8212;&#8211;  \u63a8\u8350\u4f7f\u7528<\/li><\/ul>\n\n\n\n<p>\u9759\u6001\u65b9\u6cd5, \u4f1a\u4f18\u5148\u4e8e\u7c7b\u65b9\u6cd5\u52a0\u8f7d, \u4f60<strong>\u53ef\u4ee5\u5728\u7c7b\u65b9\u6cd5\u4e2d\u8c03\u7528\u9759\u6001\u65b9\u6cd5, \u53cd\u8fc7\u6765\u5374\u4e0d\u884c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728python\u9762\u5411\u5bf9\u8c61\u4e2d, \u67092\u79cd\u5c5e\u6027 \u7c7b\u5c5e\u6027 \u5bf9\u8c61\u5c5e\u6027 \u7c7b\u5c5e\u6027, \u6307\u7684\u662f\u5c5e\u4e8e\u6b64\u7c7b\u7684\u591a\u4e2a\u5bf9\u8c61\u5171\u4eab\u8fd9\u4e9b\u53d8\u91cf \u6b64\u5916&hellip; <a href=\"https:\/\/www.52dixiaowo.com\/python\/post-104.html\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">python\u7684\u7c7b\u5c5e\u6027, \u7c7b\u65b9\u6cd5, \u9759\u6001\u65b9\u6cd5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/posts\/104"}],"collection":[{"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":0,"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52dixiaowo.com\/python\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}