title: How to get file extension correctly?
body: <p>I know that this question is asked many times on this website. But I found that they missed an important point: only file extension with one period was taken into consider like <code>*.png *.mp3</code>, but how do I deal with these filename with two period like <code>.tar.gz</code>.</p>
  
  <p>The basic code is:</p>
  
  <pre><code>filename = '/home/lancaster/Downloads/a.ppt'
  extention = filename.split('/')[-1]
  </code></pre>
  
  <p>But obviously, this code do not work with the file like <code>a.tar.gz</code>.
  How to deal with it? Thanks.</p>