Jun-28-2021, 11:09 PM
Not sure I understand the question clearly.
When you open your excel, nothing happens to it.
When you save your excel, it will overwrite, without warning, an existing file with the same name.
That's why it is good to save by adding the time, or 'version2' or something to the original file name:
(st_atime: represents the time of most recent access. It is expressed in seconds.
st_mtime: represents the time of most recent content modification. It is expressed in seconds.)
Looks like that could lead to confusion though!
# Get the status of
# the specified path
status = os.stat(path)
# Print the status
# of the specified path
print(status)
os.stat_result(st_mode=33188, st_ino=795581, st_dev=2056, st_nlink=1, st_uid=1000,
st_gid=1000, st_size=243, st_atime=1531567080, st_mtime=1530346690, st_ctime=1530346690)
When you open your excel, nothing happens to it.
When you save your excel, it will overwrite, without warning, an existing file with the same name.
That's why it is good to save by adding the time, or 'version2' or something to the original file name:
name = path.split('.') output = name[0] + 'version2.' + name[1]If by "active" you mean, more than 1 person may be accessing the excel file at the same time (i.e. "active"), you could get the last access time or modification time from os.stat(file), and compare that with the stat_result from when you opened it.
(st_atime: represents the time of most recent access. It is expressed in seconds.
st_mtime: represents the time of most recent content modification. It is expressed in seconds.)
Looks like that could lead to confusion though!
# Get the status of
# the specified path
status = os.stat(path)
# Print the status
# of the specified path
print(status)
os.stat_result(st_mode=33188, st_ino=795581, st_dev=2056, st_nlink=1, st_uid=1000,
st_gid=1000, st_size=243, st_atime=1531567080, st_mtime=1530346690, st_ctime=1530346690)