- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I get a file's permission mask 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)
The mode variable gives you the information about file permissions. You can get it by st. You can read more about interpreting the tuple here: http://effbot.org/zone/python-fileinfo.htm
- How can I get a file's size in C++?
- How to change the permission of a file using Python?
- How can I source a Python file from another Python file?
- How can I get the current week using Python?
- How can I download a file on a click event using selenium?
- How to get stat of a file using Python?
- How to get a file system information using Python?
- How can I make one Python file run another?
- How do I check whether a file exists using Python?
- How can I get all element's immediate children with css selectors using selenium?
- How do I get time of a Python program's execution?
- How can I format a float using matplotlib's LaTeX formatter?
- How to change the permission of a directory using Python?
- How can I extract or uncompress gzip file using php?
- How can I restore a file created by mysqldump?