if os.path.exists('./a.txt'):
print("file exists!")
os.remove('a.txt')
else:
print("file not exists!")
path='./mount.xml'
if not os.access(path, os.R_OK): # R_OK可读;X_OK 可执行;os.W_OK 文件写权限
print("file not exists or can't read")
python处理文件是否可读
最新推荐文章于 2023-10-07 19:49:30 发布