any(name.endswith((‘.c‘, ‘.h‘)) for name in listdir(dirname))
python 检查某个文件夹中是否存在指定的文件类型
原文:http://www.cnblogs.com/shijiu520/p/6857452.html