'Get and validate Python files

I have written a method in Flask where I am getting a list of files in a directory. The get_report method is getting list of files in the directory.Using this same method I want to validate any python script present in directory

def get_report():
    entries=os.listdir('scripts/report')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source