{"id":1535,"date":"2021-11-24T00:10:46","date_gmt":"2021-11-23T21:10:46","guid":{"rendered":"https:\/\/1.cbm.ua\/?p=1535"},"modified":"2024-07-21T12:37:06","modified_gmt":"2024-07-21T09:37:06","slug":"python-%d1%84%d1%83%d0%bd%d0%ba%d1%86%d0%b8%d1%8f-any","status":"publish","type":"post","link":"https:\/\/1.cbm.ua\/?p=1535","title":{"rendered":"\u2764\ufe0f ___ Python \u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0424\u0443\u043d\u043a\u0446\u0438\u044f any"},"content":{"rendered":"\n<p><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/all_any.html\"> URL \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f any<\/h1>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f&nbsp;<code>any<\/code>&nbsp;\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 True, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0439.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">In [7]: any([False, True, True])\nOut[7]: True\n\nIn [8]: any([False, False, False])\nOut[8]: False\n\nIn [9]: any([])\nOut[9]: False\n\nIn [10]: any(i.isdigit() for i in '10.1.1.a'.split('.'))\nOut[10]: True\n<\/pre>\n\n\n\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e any, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e ignore_command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def ignore_command(command):\n    '''\n    \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 ignore.\n    * command - \u0441\u0442\u0440\u043e\u043a\u0430. \u041a\u043e\u043c\u0430\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c\n    * \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 True, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 ignore, False - \u0435\u0441\u043b\u0438 \u043d\u0435\u0442\n    '''\n    ignore = ['duplex', 'alias', 'Current configuration']\n\n    for word in ignore:\n        if word in command:\n            return True\n    return False<\/pre>\n\n\n\n<p>\u041d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def ignore_command(command):\n    '''\n    \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 ignore.\n    command - \u0441\u0442\u0440\u043e\u043a\u0430. \u041a\u043e\u043c\u0430\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c\n    \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 True, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 ignore, False - \u0435\u0441\u043b\u0438 \u043d\u0435\u0442\n    '''\n    ignore = ['duplex', 'alias', 'Current configuration']\n\n    return any([word in command for word in ignore])<\/pre>\n\n\n\nPython &#8212; \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n\n<p><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/print.html\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f print<\/a>\n<br><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/range.html\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f range<\/a>\n<br><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/sorted.html\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f sorted<\/a>\n<br><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/enumerate.html\">enumerate<\/a>\n<br><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/lambda.html\">\u0410\u043d\u043e\u043d\u0438\u043c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435)<\/a>\n<\/p>\n\n<hr>\n\n<p><a href=\"https:\/\/1.cbm.ua\/?p=1549\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f zip (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 zip \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f)<\/a>\n<br><a href=\"https:\/\/1.cbm.ua\/?p=1528\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f all<\/a>\n<br><a href=\"https:\/\/1.cbm.ua\/?p=1535\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f any<\/a>\n<br><a href=\"https:\/\/1.cbm.ua\/?p=1505\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f map<\/a>\n<br><a href=\"https:\/\/1.cbm.ua\/?p=1501\">\u0424\u0443\u043d\u043a\u0446\u0438\u044f filter<\/a>\n<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/pyneng.readthedocs.io\/ru\/latest\/book\/10_useful_functions\/all_any.html#all\"><\/a><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>URL \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0424\u0443\u043d\u043a\u0446\u0438\u044f any \u0424\u0443\u043d\u043a\u0446\u0438\u044f&nbsp;any&nbsp;\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 True, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e any, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e ignore_command: \u041d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442: Python &#8212; \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0424\u0443\u043d\u043a\u0446\u0438\u044f print \u0424\u0443\u043d\u043a\u0446\u0438\u044f range \u0424\u0443\u043d\u043a\u0446\u0438\u044f sorted enumerate \u0410\u043d\u043e\u043d\u0438\u043c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (\u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435) \u0424\u0443\u043d\u043a\u0446\u0438\u044f zip (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 zip \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f) \u0424\u0443\u043d\u043a\u0446\u0438\u044f all \u0424\u0443\u043d\u043a\u0446\u0438\u044f any \u0424\u0443\u043d\u043a\u0446\u0438\u044f map \u0424\u0443\u043d\u043a\u0446\u0438\u044f filter<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[2],"tags":[25],"class_list":["post-1535","post","type-post","status-publish","format-standard","hentry","category-python","tag-help"],"_links":{"self":[{"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/posts\/1535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1535"}],"version-history":[{"count":4,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/posts\/1535\/revisions"}],"predecessor-version":[{"id":6367,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=\/wp\/v2\/posts\/1535\/revisions\/6367"}],"wp:attachment":[{"href":"https:\/\/1.cbm.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1.cbm.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}