mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
getsize(), getatime(), getmtime():
Constants from stat module were imported using "import *"; don't access them via stat.ST_*! Reported by that other vR. ;-)
This commit is contained in:
parent
de5d5ce7bc
commit
69f87c580d
1 changed files with 3 additions and 3 deletions
|
@ -104,17 +104,17 @@ def isdir(s):
|
|||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
return st[ST_SIZE]
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
return st[ST_MTIME]
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
return st[ST_MTIME]
|
||||
|
||||
|
||||
# Return true if the pathname refers to a symbolic link.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue