📅  最后修改于: 2022-03-11 14:46:50.806000             🧑  作者: Mango
Assuming m is a string, you can use endswith:
if m.endswith('.mp3'):
...
elif m.endswith('.flac'):
...
To be case-insensitive, and to eliminate a potentially large else-if chain:
m.lower().endswith(('.png', '.jpg', '.jpeg'))