这是我的代码:
import commands
mount = commands.getoutput('mount -v')
lines = mount.splitlines()
points = map(lambda line: line.split()[2], lines)
permission = map(lambda line: line.split()[5], lines)
print points
print permission
我得到的输出是:
['/', '/proc', '/sys', '/dev/pts', '/dev/shm', '/boot', '/proc/sys/fs/binfmt_misc', '/var/lib/nfs/rpc_pipefs']
['(rw)', '(rw)', '(rw)', '(rw,gid=5,mode=620)', '(rw,rootcontext="system_u:object_r:tmpfs_t:s0")', '(rw)', '(rw)', '(rw)']
我想在它前面显示每个分区的权限。像:
'/' (rw)
'/proc' (rw)
等等。如何做呢?