title: What's the neatest way to get a value from a dictionary and convert to an integer if it exists – in python 3.8?
body: <p>I'm looking for a neater way to retrieve a value from a dictionary (if it exists) and convert to an integer (or replace with 0) using python 3.8.</p>
  <p>Here's the code I'm using now:</p>
  <pre class="lang-py prettyprint-override"><code>import re
  data = {&quot;x&quot;:&quot;10&quot;, &quot;y&quot;:&quot;blank&quot;}
  
  for key in data.keys():
      n = data.get(key,0)
      n = int(n) if re.search(&quot;[0-9]+&quot;, n) else 0
      print(n)
  </code></pre>
  <p>I'd like to condense the <code>int</code> conversion into one line – possibly without regex? Is that possible? Or perhaps using a pipe feature to move the logic to to the same line?</p>