title: Read lines from a text file into variables
body: <p>I have two different functions in my program, one writes an output to a txt file (function A) and the other one reads it and should use it as an input (function B).</p>
  
  <p>Function A works just fine (although i'm always open to suggestions on how i could improve).
  It looks like this:</p>
  
  <pre><code>def createFile():
      fileName = raw_input("Filename: ")
      fileNameExt = fileName + ".txt" #to make sure a .txt extension is used
  
      line1 = "1.1.1"
      line2 = int(input("Enter line 2: ")
      line3 = int(input("Enter line 3: ")
  
      file = (fileNameExt, "w+")
      file.write("%s\n%s\n%s" % (line1, line2, line3))
      file.close()
  
      return
  </code></pre>
  
  <p>This appears to work fine and will create a file like</p>
  
  <pre><code>1.1.1
  123
  456
  </code></pre>
  
  <p>Now, function B should use that file as an input. This is how far i've gotten so far:</p>
  
  <pre><code>def loadFile():
      loadFileName = raw_input("Filename: ")
      loadFile = open(loadFileName, "r")
  
      line1 = loadFile.read(5)
  </code></pre>
  
  <p>That's where i'm stuck, i know how to use this first 5 characters but i need line 2 and 3 as variables too.</p>