I\'m trying to search through a specific directory full of header files, and look through each header file, and if any file has a string \"struct\" in it, I just want the progra
This works when I test it on my end:
for files in glob.glob( "*.h" ): f = open( files, 'r' ) file_contents = f.read() if "struct" in file_contents: print f.name f.close()
Make sure you print f.name, otherwise you're printing the file object, and not the name of the file itself.
f.name