$ find /path/to/dir -maxdepth 1 -type f -name "*.py" | wc -l