socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

writing better dev names as keys for diezweite

This commit is contained in:
David 2012-05-16 17:32:04 +02:00
parent 4f9379c4e2
commit fd836bf578
1 changed files with 3 additions and 3 deletions

View File

@ -7,9 +7,9 @@ import os
# getting all local partitions plus their uuids
def getpartitions():
uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices
parts = {} #initializing empty dictionary for partition labels/names and uuids
for uuid in uuids: #write labels/names as keys and uuids as values in the dictionary
parts[os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
parts = {} #initializing empty dictionary for partitions and uuids
for uuid in uuids: #write /dev/names as keys and uuids as values in the dictionary
parts["/dev/" + os.readlink("/dev/disk/by-uuid/" + uuid)[6:]] = uuid
return parts #return the dictionary for further useage