I am developing a Python script in which I want to scan whole sub directories to find .log files.
To get a list of .log files, I can get the file names. Here is the code.
for root, dirs, files in os.walk("Directory to be analyse"):
for file in files:
if file.endswith('.log'):
Now, How to iterate all files in for loop and get the contents of it?