I have to make a function that takes a directory path or name and count number of LOG files inside it
This should work:
def count_log_files(folder): return len([f for f in os.listdir(folder) if f.endswith('.LOG')])
2.1m questions
2.1m answers
60 comments
57.0k users