splittext()方法

path,file=os.path.split(file_url)
dir, suffix = os.path.splitext(infile)

获取后缀名的方法

if full.endswith(".py"):
    print("is py")