for _, _, filenames in os.walk(folder):
    for file in filenames:
        fileExt = os.path.splitext(file)[-1]
if fileExt == '.c':
    results.append(file)
Python: How can I find all files with a particular extension?