title: python3 extract string between two strings in a txt file
body: <p>I am new to Python. I am trying to extract one string ("concluded that our disclosure controls were effective as of") from a txt file ("infile.txt"). The file is relatively large, and I need to look for the above string in one particular section (between the "ITEM &amp; nbsp;9A" and the "ITEM &amp; nbsp;9B"). An example of such section follows:</p>
  
  <pre><code>&lt;/A&gt;ITEM&amp;nbsp;9A. CONTROLS AND PROCEDURES. &lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P STYLE="margin-top:6px;margin-bottom:0px"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;&lt;B&gt;Evaluation of Disclosure Controls and Procedures &lt;/B&gt;&lt;/FONT&gt; STYLE="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;Under the supervision and with the participation of our management, including our Chief Executive Officer and Chief Financial Officer, we conducted an evaluation of the effectiveness of our disclosure controls and procedures (as defined in Rules 13a-15(e) and 15d-15(e) under the Securities Exchange Act of 1934, as amended (Exchange Act)), as of the end of the period covered by this Annual Report on Form 10-K. Management recognizes that any controls and procedures, no matter how well designed and operated, can provide only reasonable assurance of achieving their objectives and management necessarily applies its judgment in evaluating the cost-benefit relationship of possible controls and procedures. Based on such evaluation, our Chief Executive Officer and Chief Financial Officer concluded that our disclosure controls and procedures were effective as of September&amp;nbsp;28, 2012. &lt;/FONT&gt;&lt;/P&gt; &lt;P STYLE="margin-top:18px;margin-bottom:0px"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;&lt;B&gt;Management&amp;#146;s Annual Report on Internal Control over Financial Reporting &lt;/B&gt;&lt;/FONT&gt; &lt;P STYLE="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;This Annual Report does not include a report of management&amp;#146;s assessment regarding internal control over financial reporting or an attestation report of the company&amp;#146;s registered public accounting firm due to a transition period established by rules of the Securities and Exchange Commission for newly public companies. &lt;/FONT&gt; &lt;P STYLE="margin-top:18px;margin-bottom:0px"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;&lt;B&gt;Changes in Internal Control over Financial Reporting &lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt; &lt;P STYLE="margin-top:6px;margin-bottom:0px; text-indent:4%"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;There were no changes in our internal control over financial reporting (as defined in Rule&amp;nbsp;13a-15(f) under the Exchange Act) during the quarter ended September&amp;nbsp;28, 2012, that have materially affected, or are reasonably likely to materially affect, our internal control over financial reporting. &lt;/FONT&gt; &lt;P STYLE="margin-top:18px;margin-bottom:0px"&gt;&lt;FONT STYLE="font-family:Times New Roman" SIZE="2"&gt;&lt;B&gt;&lt;A NAME="tx431171_16"&gt;&lt;/A&gt;ITEM&amp;nbsp;9B. OTHER INFORMATION.
  </code></pre>
  
  <p>If the section has the desired string "concluded that our disclosure controls were effective as of" (the above section has it aprox. in the middle), then I would like to print a "1" in a separate "output.csv" file, if it does not, print "not found". The starting point of the section does not always coincide with the start of a line. I am sorry but could not figure out how to start.... I am using Python 3.6.</p>
  
  <p>Thank you very much in advance!</p>