Gust Posted September 8, 2006 at 01:25 PM Report Share #49086 Posted September 8, 2006 at 01:25 PM Alguem conhece uma biblioteca em python que nos de info sobre o sistema. Ex. Espaço em disco, RAM, etc... Obr. "A computer program it's a world, the programmer its God" Link to comment Share on other sites More sharing options...
Triton Posted September 8, 2006 at 02:08 PM Report Share #49094 Posted September 8, 2006 at 02:08 PM Dá uma vista de olhos no módulo OS. import statvfs import os st = os.statvfs(".") print "preferred block size", "=>", st[statvfs.F_BSIZE] print "fundamental block size", "=>", st[statvfs.F_FRSIZE] print "total blocks", "=>", st[statvfs.F_BLOCKS] print "total free blocks", "=>", st[statvfs.F_BFREE] print "available blocks", "=>", st[statvfs.F_BAVAIL] print "total file nodes", "=>", st[statvfs.F_FILES] print "total free nodes", "=>", st[statvfs.F_FFREE] print "available nodes", "=>", st[statvfs.F_FAVAIL] print "max file name length", "=>", st[statvfs.F_NAMEMAX] Para obter a RAM podes usar esta função (é preciso o módulo ctypes): from ctypes import * kernel32 = windll.kernel32 class MEMORYSTATUS(Structure): _fields_ = [ ('dwLength', c_ulong), ('dwMemoryLoad', c_ulong), ('dwTotalPhys', c_ulong), ('dwAvailPhys', c_ulong), ('dwTotalPageFile', c_ulong), ('dwAvailPageFile', c_ulong), ('dwTotalVirtual', c_ulong), ('dwAvailVirtual', c_ulong) ] def getTotalPhysicalBytes(): memoryStatus = MEMORYSTATUS() memoryStatus.dwLength = sizeof(MEMORYSTATUS) kernel32.GlobalMemoryStatus(byref(memoryStatus)) return memoryStatus.dwTotalPhys if __name__ == '__main__': bytes = getTotalPhysicalBytes() print "Total physical RAM: %d bytes (%dMB)" % (bytes, bytes / 1024 / 1024) Explora este link, tem mais formas de fazer. 👍 <3 life Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now