{"id":911,"date":"2017-09-01T16:10:30","date_gmt":"2017-09-01T13:10:30","guid":{"rendered":"http:\/\/surgery.moscow\/smos\/?p=911"},"modified":"2025-02-06T11:41:13","modified_gmt":"2025-02-06T08:41:13","slug":"%d1%83%d1%87%d0%b8%d0%bc-python-%d0%bf%d0%b5%d1%80%d0%b5%d0%ba%d1%80%d0%b5%d1%81%d1%82%d0%bd%d1%8b%d0%b9-%d0%bf%d0%be%d0%b8%d1%81%d0%ba-for-line-in-test-txt","status":"publish","type":"post","link":"https:\/\/surgery.moscow\/smos\/2017\/09\/01\/%d1%83%d1%87%d0%b8%d0%bc-python-%d0%bf%d0%b5%d1%80%d0%b5%d0%ba%d1%80%d0%b5%d1%81%d1%82%d0%bd%d1%8b%d0%b9-%d0%bf%d0%be%d0%b8%d1%81%d0%ba-for-line-in-test-txt\/","title":{"rendered":"\u0423\u0447\u0438\u043c Python : \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a  for line in  file"},"content":{"rendered":"<h2>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0438\u0437\u0443\u0447\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Python \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435.<\/h2>\n<p>\u0414\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b test.txt \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<p><em><a href=\"http:\/\/surgstore.ru\/\"> SurgStore<\/a> online surgery store<\/em><br \/>\n<em> surgery moscow<\/em><br \/>\n<em> bariatric.ru<\/em><\/p>\n<p>\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0446\u0438\u043a\u043b for \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0435, \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<p><strong>for line in open(&#8216;test.txt&#8217;):<\/strong><br \/>\n<strong>\u00a0 \u00a0 \u00a0if &#8216;moscow&#8217; in line:<\/strong><br \/>\n<strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0print(&#8216;true&#8217;,line)<\/strong><\/p>\n<p>\u0432 \u044d\u0442\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435:<\/p>\n<p><strong>for line in<\/strong>&#8212; \u0446\u0438\u043a\u043b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0444\u0430\u0439\u043b test.txt<\/p>\n<p><strong>if &#8216;moscow&#8217; in line<\/strong> &#8212; \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 <strong>for<\/strong>, \u0435\u0441\u043b\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u00a0<strong>moscow<\/strong>\u00a0 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u0438\u043d\u043e\u0439 , \u00a0\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u00a0<strong>print()<\/strong>.<\/p>\n<p><strong>print(&#8216;true&#8217;,line) <\/strong>&#8212; \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u043e\u00a0<strong>true<\/strong> \u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430\u00a0<strong>surgery moscow<\/strong>\u00a0\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0438\u0441\u043a\u043e\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u043e<\/p>\n<p>\u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<p><strong>true surgery moscow<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0438\u0437\u0443\u0447\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Python \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0430\u0439\u043b\u0435. \u0414\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e<\/p>\n","protected":false},"author":1,"featured_media":912,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,12,22],"tags":[],"class_list":["post-911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computer","category-internet","category-technology"],"_links":{"self":[{"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/posts\/911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/comments?post=911"}],"version-history":[{"count":10,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/posts\/911\/revisions"}],"predecessor-version":[{"id":6721,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/posts\/911\/revisions\/6721"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/media\/912"}],"wp:attachment":[{"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/media?parent=911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/categories?post=911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/surgery.moscow\/smos\/wp-json\/wp\/v2\/tags?post=911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}