os模块获取文件后缀名 import os url = 'http://music.163.com/song/media/outer/url?id=562598065.mp3' suffix = os.path.splitext(url)[1] print(suffix) 输出:.mp3