title: How to get a specific chunk of text from a URL of a text file?
body: <pre><code>for i in range(len(file)) :
  a = file.loc[i, &quot;SECFNAME&quot;]
  url = ('https://www.sec.gov/Archives/' + a)
  response = requests.get(url)
  soup = BeautifulSoup(response.text, &quot;html.parser&quot;)
  txt = str(soup)
  text = txt.lower()
  doc_lenght = len(text)
  
  for line in urllib.request.urlopen(url):
      print(line.decode('utf-8'))
      def mdaa(text, doc_lenght):
          if elem in text.find(&quot;ITEM 7. MANAGEMENT'S DISCUSSION AND ANALYSIS &quot;):
              print (elem)
          else :
              pass
  </code></pre>
  <blockquote>
  <p>The link has a section called as MANAGEMENT'S DISCUSSION AND ANALYSIS below that it has its description or a chunk of text that needs to be scraped. From the code above I am only able to print the whole document and not that specific part.</p>
  <p>In dataset process needs to be done for each row value in the dataset(file) in which the URLs are given. So In Python, when given the URL for a text file, what is the simplest way to access the contents off the text file and print the contents of the file out locally line-by-line without saving a local copy of the text file?</p>
  </blockquote>