title: Storing the first word in each line of a string into a list
body: <p>I have a string containing multiple lines. Each line is broken by '\n' and contains commas after each word. I want to store the first word in each line into a list.</p>
  
  <p>Here is the string output:</p>
  
  <pre><code>AIG,10,,,,Yes,,,Jr,,,MS,,
  Baylor College of Medicine,19,Yes,Yes,,,,,,,,,,Recent
  CGG,17,Yes,Yes,,,,,,,,MS,PhD,Recent
  Citi,27/28,Yes,,,Yes,,,Jr,Sr,,,,
  </code></pre>
  
  <p>My list should be <code>['AIG', 'Baylor College of Medicine', 'CGG', 'Citi']</code></p>
  
  <p>I thought about using split after the first comma and then go to the next line, but I do not know how I can achieve this.</p>
  
  <p><hr>
  <strong>My Solution was to go back in my code and search for a list of "companies" I previously made.</strong></p>
  
  <p><strong>companies =</strong></p>
  
  <p><code>['AIG,10,,,,Yes,,,Jr,,,MS,,\n', 'Baylor\xa0College\xa0of\xa0Medicine,19,Yes,Yes,,,,,,,,,,Recent\n', 'CGG,17,Yes,Yes,,,,,,,,MS,PhD,Recent\n', 'Citi,27/28,Yes,,,Yes,,,Jr,Sr,,,,\n', 'ExxonMobil,11,Yes,,,Yes,Fr,Soph,Jr,Sr,PB,,,\n', 'Flow-Cal\xa0Inc.,16,Yes,,,Yes,,,Jr,Sr,,,,All\n', 'Global\xa0Shop\xa0Solutions,18,Yes,,,Yes,,,,Sr,PB,,,All\n']</code></p>
  
  <pre><code>cmpny_name = []
  for i  in companies:
      cmpny_name.append(i.split(',', 1)[0])
  
  cmpny_name = [c.replace('\xa0', ' ') for c in cmpny_name]
  print(cmpny_name)
  
  OUTPUT:['AIG', 'Baylor College of Medicine', 'CGG', 'Citi', 'ExxonMobil', 'Flow-Cal Inc.', 'Global Shop Solutions', 'Harris County CTS', 'HCSS', 'Hitachi Consulting', 'HP Inc.', 'INT Inc.']
  </code></pre>