os.path.getmtime() in Python is used to get the time of the last modification of a specified path. This method returns a floating point value that represents the number of seconds since the beginning of the epoch. This method raises an OSError if the file does not exist or is not available.
Note: The epoch represents the point where time begins. It depends on the platform. For Unix, the era of — January 1, 1970 00:00:00 UTC.
Syntax: os.path.getmtime (path) p>
path : A path-like object representing a file system path. A path-like object is either a string or bytes object representing a path.
Return Type: This method returns a floating-point value of class `float` that represents the time (in seconds) of last modification of the specified path.
Code # 1 : Using the os.path.getmtime () method
| tr > |
Last modification time since the epoch: 1558447897.0442736 Last modification time (Local time): Tue May 21 19:41:37 2019
Code # 2: Error handling when using the os.path.getmtime () method
Path `/ home / User / Documents / file2.txt` does not exists or is inaccessible pre >
The Apache Hadoop software library has come into it’s own. It is the basis for advanced distributed development for a host of companies, government institutions, and scientific research facilities. ...
R for Everyone: Advanced Analytics and Graphics. ...
We are experiencing a renaissance of artificial intelligence, and everyone and their neighbor wants to be a part of this movement. That’s quite likely why you are browsing through this book. There a...
Data is “unreasonably effective”. Nobel laureate Eugene Wigner referred to the unreasonable effectiveness of mathematics in the natural sciences. What is big data? Its sizes are in the order of te...