title: Python extract first element from list and clean strings
body: <p>I am parsing txt files (of +100 pages long) and would like to extract the sentence in which the string "public offering price" appears for the first time. Plus, I want to clean the "&amp;nbsp" characters in that sentence. </p>
  
  <p>I run the following code over a series of files (file_list):</p>
  
  <pre><code>test1 = [] #create a new list to store my desired output
      for eachfile in file_list:
          with open(eachfile, 'r') as f:
              for line in f:
                  if "public offering price" in line:
                      test1.append(line.replace('&amp;nbsp;','').split('.')[0])
      print(test1)
  </code></pre>
  
  <p>With the above code I successfully clean the <code>"&amp;nbsp;"</code> characters and split elements when a "." is present (something that helps for my desired output), but obtain the following output:</p>
  
  <pre><code>['public offering price will be between $and $per share', 'toadditional shares of our common stock at the initial public offering price', '(2)an initial public offering price of $per share']
  </code></pre>
  
  <p>The above output gives me all sentences including my desired string, but I only want to keep the first occurrence: </p>
  
  <pre><code>['public offering price will be between $and $per share]
  </code></pre>
  
  <p>Any idea of how to obtain such output? It must be easy to implement given the code I run, but couldn't figure out how...</p>
  
  <p>Thank you so much in advance,  </p>
  
  <p>EDIT: The output obtained without replacing or splitting('.')[0] is the following:</p>
  
  <pre><code>['public offering price will be between $&amp;nbsp;&amp;nbsp;&amp;nbsp;and $&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;per share. We intend to apply to list the common stock on\n', 'to&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;additional shares of our common stock at the initial public offering price.&lt;/FONT&gt;\n', '(2)&amp;nbsp;an initial public offering price of $&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;per share, the midpoint of the initial public offering range indicated on the cover of this prospectus. &lt;/FONT&gt; &lt;FONT SIZE=2&gt;\n']
  </code></pre>