
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to get stat of a file using Python?
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: http://effbot.org/zone/python-fileinfo.htm
- Related Articles
- How to get a file system information using Python?
- Interpreting stat() results using Python
- How to get creation and modification date/time of a file using Python?
- How to get the maximum file name length limit using Python?
- How to create a duplicate file of an existing file using Python?
- How to create hardlink of a file using Python?
- How to create softlink of a file using Python?
- How to rename a file using Python?
- How to remove a file using Python?
- How to find a file using Python?
- How to delete a file using Python?
- How can I get a file's permission mask using Python?
- How to get the absolute path of a file using tkFileDialog(Tkinter)?
- How to check the permissions of a file using Python?
- How to change the permission of a file using Python?

Advertisements