title: try/except block catching multiple exceptions
body: <p>I am trying to create a try except that catches 3 errors:</p>
  <ol>
  <li>the first one if the user enters the name if the file which is not a txt file,</li>
  <li>the second is if the file is empty then an error Is thrown and</li>
  <li>the third is for if the file entered does not exist then an error is thrown as well.</li>
  </ol>
  <p>I did try to do the first one where an error messages thrown if the file is not a txt file but I am also getting an error for that one saying 'str' object has no attribute 'contains'</p>
  
  <pre><code>try:
     file_name = input(&quot;Enter file name: &quot;)
     assert not file_name.contains(&quot;.txt&quot;)
  except AssertionError:
     (&quot;Error, must be a txt file&quot;)
  file_fh = open(file_name)
  counter = 0
  avg = 0
  for line in file_fh:
       if not line.startswith(&quot;X-DSPAM-Confidence:&quot;): continue
       avg += float(line[20:-1].strip())
       counter = counter + 1
   print(&quot;Average spam confidence:&quot;, round(avg / counter, 4))
  </code></pre>