import re mp4_path = "D:电影电视我不是药神-2018_BD国语中字.mp4" def get_file_name(path_string): """获取文件名称""" pattern = re.compile(r'([^<>/\|:""*?]+).w+$') data = pattern.findall(path_string) if data: return data[0]