title: Try/except to check string
body: <p>I am confused on how to use <code>Try/Exception</code> and <code>if/else</code>. How can I write idiomatic code if I want to tell the user to provide <code>.html</code> file </p>
  
  <pre><code>if url[-4:] ==".html":
          // do your things
  else: 
      print('Error! the file is not html file')
  </code></pre>
  
  <p>I am checking whether I should use <code>try/exception</code> in such scenarios or <code>if/else</code> as I did. </p>