From 6b39e15c871d7b5492f1c3066e92a5882c17307e Mon Sep 17 00:00:00 2001 From: David Date: Thu, 17 May 2012 13:01:13 +0200 Subject: [PATCH] my first class :) --- diskusage_diezweite.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/diskusage_diezweite.py b/diskusage_diezweite.py index f14546b..51eee0b 100755 --- a/diskusage_diezweite.py +++ b/diskusage_diezweite.py @@ -3,17 +3,19 @@ import os +class partobj(object): #my first class :) +# def __init__(self): +# self.dev = "" -# 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 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 + # getting all local partitions plus their uuids + def getpartitions(self): + self.uuids = os.listdir("/dev/disk/by-uuid") #folder contains symlinks to the actual disk devices + self.parts = {} #initializing empty dictionary for partitions and uuids + for self.uuid in self.uuids: #write /dev/names as keys and uuids as values in the dictionary + self.parts["/dev/" + os.readlink("/dev/disk/by-uuid/" + self.uuid)[6:]] = self.uuid + return self.parts #return the dictionary for further useage - -partitions = getpartitions() -print partitions - +test = partobj() +bla = test.getpartitions() +print bla