# 在linux环境执行的
import os,stat
files = [name for name in os.listdir('.') if name.endswith(('.sh','.py'))] # 获取本目录以sh,py结尾的文件
print(files)
for f in files:
# os.chmod 修改权限
# os.stat(f).st_mode 文件的权限
# stat.S_IXUSR 对于拥有者执行的权限
os.chmod(f,os.stat(f).st_mode | stat.S_IXUSR)