title: Python: joining multiple lines into a single line/string and appending it to a list
body: <p>Basically I have a text file, I am reading it line by line. I want to merge some lines together (a part of the text) in to a single string and add it as an element to a list.</p>
  
  <p>These parts of the text that I want to combine start with the letters "gi" and end with ">". I can successfully isolate this part of the text but I am having trouble manipulating with it in any way, i would like it to be a single variable, acting like a individual entity. So far it is only adding single lines to the list.</p>
  
  <pre><code>def lines(File):
      dataFile = open(File)
      list =[]
      for letters in dataFile:
          start = letters.find("gi") + 2 
          end = letters.find("&gt;", start)
          unit = letters[start:end]
          list.append(unit)
      return list
  </code></pre>
  
  <p>This is an example:
  <a href="https://www.dropbox.com/s/1cwv2spfcpp0q0s/pythonmafft.txt?dl=0" rel="nofollow">https://www.dropbox.com/s/1cwv2spfcpp0q0s/pythonmafft.txt?dl=0</a></p>
  
  <p>So every entry that is in the file I would like to manipulate as a single string and be able to append it to a list. Every entry is seperated by a few empty lines.</p>