The os.access () function is in some cases better than os.stat () , because it checks whether the file can be executed by you, according to the owner of the file, group and rights.
import os for filename in os.listdir('.'): if os.path.isfile(filename) and os.access(filename, os.X_OK): print(filename)
Messa source share