我运行一个python脚本和做的是第一件事情,它需要检查文件的权限它执行整个程序之前。
我目前使用的os.system("stat -c '%a' /data/lims/LI")
是有没有更好的办法做到这一点,而不使用使用os.system?
我的实际编码是
checker = int(os.system("stat -c '%a' /data/lims/LI"))
if checker != 000:
print "pass"
我想检查文件的权限应该是一个数...像755, 750, and others
如果它是一个可执行权限,不是执行。