On Mon, 29 Oct 2007 16:52:12 -0500, Korthrun wrote: > I'm writing some scripts to populate RRD's, mainly for practicing python. > > As such I've decided to play with statvfs in order to build disk > graphs. Here is what I have and what I get. What I'm curious about > here is the meaning of the "L" charcter, as that fubars math.
The L means its a `long` literal, i.e. an integer value that can be arbitrary big. Well its limited by memory of course. And it doesn't "fubar" math, the L just shows up in the string representation but you don't calculate with strings but numbers. > ###start code### > > from os import statvfs, path > from statvfs import * > > mps = [ '/', '/home', '/www', '/var', '/storage/backups', > '/storage/snd' ] > > for fs in mps: > data = statvfs(fs) > print data > > ###end code, start output### > (4096, 4096, 4883593L, 4045793L, 4045793L, 0L, 0L, 0L, 1024, 255) > (4096, 4096, 1220889L, 1114718L, 1114718L, 0L, 0L, 0L, 0, 255) > (4096, 4096, 19267346L, 18273138L, 18273138L, 0L, 0L, 0L, 0, 255) > (4096, 4096, 3662687L, 3492397L, 3492397L, 0L, 0L, 0L, 0, 255) > (4096, 4096, 3417702L, 2116063L, 2116063L, 0L, 0L, 0L, 0, 255) > (4096, 4096, 25885944L, 21799115L, 21799115L, 0L, 0L, 0L, 0, 255) > ###end output### > > Ideally I'll just do some blocksize * number of blocks math to get > the % of used space. Just go ahead and do it: In [185]: stat = os.statvfs('/') In [186]: stat.f_bsize Out[186]: 4096 In [187]: stat.f_blocks Out[187]: 2622526L In [188]: stat.f_bsize * stat.f_blocks Out[188]: 10741866496L Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list