How to get stat of a file using Python?

PythonServer Side ProgrammingProgramming

To get stat of a file, method stat() from the os module can be used. It performs a stat system call on the given path. For example,

import os
st = os.stat("file.dat")

This function takes the name of a file, and returns a 10-member tuple with the following contents:

(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)

Now you can use this to interpret the result. For more info on the stat result, refer:

Published on 26-Dec-2017 12:18:40