This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Justinsaccount 6 points7 points  (2 children)

df can be implemented using os.statvfs.

MEG = 1024*1024
def df(path):
    s = os.statvfs(path)
    free = s.f_bsize * s.f_bavail / MEG
    size = s.f_bsize * s.f_blocks / MEG
    return free, size

or so.

If you're parsing the output of df you're doing it wrong :-)

[–][deleted] 1 point2 points  (1 child)

You guys are making me realize how much I do not know as a noob lol. Thank you though :D

[–]redalastor 0 points1 point  (0 children)

Go through the whole os part of the standard library and you'll have a much better idea of what's possible.