获取指定目录下的所有文件名称 def GetFileName(filepath): for dirpath,dirname,file in os.walk(filepath): return file[0] # 返回的是列表,可以有多个文件名称,代表第一个文件