Python3 Os Stat
# Python3.x Python3 os.stat() Method
[ Python3 OS File/Directory Methods](#)
* * *
### Overview
The os.stat() method is used to perform a system stat call on a given path.
### Syntax
The syntax for the **stat()** method is as follows:
os.stat(path)
### Parameters
* **path** -- Specifies the path.
### Return Value
stat structure:
* **st_mode:** inode protection mode.
* **st_ino:** inode node number.
* **st_dev:** device where the inode resides.
* **st_nlink:** number of links to the inode.
* **st_uid:** user ID of the owner.
* **st_gid:** group ID of the owner.
* **st_size:** size of a regular file in bytes; contains data waiting for certain special files.
* **st_atime:** time of last access.
* **st_mtime:** time of last modification.
* **st_ctime:** "ctime" as reported by the operating system. On some systems (like Unix) it is the time of the last metadata change, on others (like Windows) it is the creation time (see platform documentation for details).
### Example
The following example demonstrates the use of the stat() method:
#!/usr/bin/python3import os, sys # Display information for file "a2.py" statinfo = os.stat('a2.py')print (statinfo)
The output of executing the above program is:
posix.stat_result(st_mode=33188, st_ino=3940649674337682L, st_dev=277923425L, st _nlink=1, st_uid=400, st_gid=401, st_size=335L, st_atime=1330498089, st_mtime=1330498089, st_ctime=1330498089)
[ Python3 OS File/Directory Methods](#)
YouTip