title: write try and except in a single line in python
body: <p>I have a list of addresses and latitude,longitudes which I am printing from a text file. It has a few 0's so I am using <code>try</code> and <code>except</code> blocks.</p>
  
  <p>Now I want to save the output to a CSV file and I am trying this code:</p>
  
  <pre><code>with open("qwe.txt",'r') as fp, open("qwert.txt",'w') as fr:
      for line in fp:
          #try:
              g= geocoder.google(line)
              #print(g.address,g.latlng)
         # except:
              #print(0,0)
              writer = csv.writer(fr, delimiter=',')
              writer.writerows(zip(g.address,g.latlng))
  
  fp.close()
  </code></pre>
  
  <p>but the loop is exiting when there is 0 occurence. I want to write <code>try</code> and <code>catch</code> on a single line so that I can print the output to a CSV.</p>
  
  <p>I tried using <code>lambda</code> but looks like <code>lamda</code> doesn't work for <code>try</code> and <code>except</code>.</p>