title: Replace elements in list with substring contained in elements
body: <p>Given this list of names</p>
  <pre><code>names=['Anna, Mrs. James (Nadia Elf)', 'Martin, Mr. Michael ', 'Barese, Mr. Alfred', 'Amalfi, Mrs. Abby (J E V)'
        ,'Manuel, Dr. Louis']
  </code></pre>
  <p>I am trying to replace each name with just its title.</p>
  <p>For instance, the first name is 'Anna, Mrs. James (Nadia Elf)'
  and I want to replace it with just 'Mrs'.</p>
  <p>In order to make sure that the following code works the way I want to and each name is replaced by its title, I have to repeat these lines</p>
  <pre><code>titles = []
  for i in names:
      new_string = i.replace(&quot;Anna, Mrs. James (Nadia Elf)&quot;, &quot;Mrs&quot;)
      titles.append(new_string)
  print(titles)
  </code></pre>
  <p>for every single item in the list.
  How should I write a code that takes care of this issue with no more than a few lines?</p>