title: Returning multiple lines from a text file in python
body: <p>I had a function which I wanted to read a file and return multiple values from it though I'm having trouble understanding how this would work. For example if my text file look like this:</p>
  
  <pre><code>John 2543
  Jack 2453
  Henry 3672
  Jane 2405 
  Terry 9863
  </code></pre>
  
  <p>And my code like this:</p>
  
  <pre><code>def function(): 
  
      file = open('file.txt')    
  
      for lines in file:
          name, number = lines.split(' ')
          return name
  
  def main():
      print(function())
  
  main()
  </code></pre>
  
  <p>This only returns a name from one line where as I want the entire first column. I understand that if I did a print function instead of return one that would work. However, in this scenario I would like to return the values so that I can use them in conjunction with my other functions. Thank you.</p>
  
  <p>EDIT:</p>
  
  <p>I also had a follow up question as to how I would print the two columns side by side while dedicating a function to each column. So normally, when I print one column after another it would appear as:</p>
  
  <pre><code>John 
  Jack 
  Henry 
  Jane 
  Terry 
  2543
  2453
  3672
  2405 
  9863
  </code></pre>
  
  <p>when I want them to appear as:</p>
  
  <pre><code>John 2543
  Jack 2453
  Henry 3672
  Jane 2405 
  Terry 9863
  </code></pre>