title: Python - Store strings from text file into a variable
body: <p>I'm wanting a script that will store the first word from each line from an input file into a variable.</p>
  
  <p>Current code only stores the last name.</p>
  
  <pre><code>def func(file): 
    global user 
    with open(file) as iFile: 
      for line in iFile: 
      string = line.split(',') 
      user = string[0]
  
  func(sys.argv[1]) 
  print user
  </code></pre>
  
  <p>The text file input is:</p>
  
  <pre><code>string1,string2,string3
  string1,string2,string3
  string1,string2,string3
  </code></pre>
  
  <p>I want the variable <code>user</code> to store the all of the string1's on each line from the text file.</p>