filetype.py Small and dependency free Python package to infer file type and MIME type checking the magic numbers signature of a file or buffer. This . 一个小巧自由开放Python开发包,主要用来获得文件类型.包要求Python .+ 功能特色 •简单友好的API •支持宽范围文件类型 •提供文件扩展名和MIME类型判断 •文件的MIME类型扩展新
Python模糊查询本地文件夹去除文件后缀 import os,re def fuzzy_search(path): word= input('请输入要查询的内容:') for filename in os.listdir(path): #遍历指定文件夹 re_filename = re.findall('.\w+', str(filename)) #去除文件后缀名 if word in re_filename[0]: print(re_filename[0])