title: Sum elements in list under condition(python)
body: <pre><code>sum( int(i.replace(',',''))if re.search('\d',i)!=None for i in list)
  </code></pre>
  
  <p>I would like to sum all elements in a list. The problems is that elements are strings, some of them have numbers in them and i would like convert them into integers and then added them up. That is why I need to check if there are numbers in the string. How can I add a condition to the list in the sum function. Also I want to use the sum function I dont want to just iterate through the list and then add to a variable. </p>