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 *.png *.mp3
, but how do I deal with these filename with two period like .tar.gz
.
The basic code is:
filename = '/home/lancaster/Downloads/a.ppt'
extention = filename.split('/')[-1]
But obviously, this code do not work with the file like a.tar.gz
.
How to deal with it? Thanks.
Aucun commentaire:
Enregistrer un commentaire