There is a requirement that I need to unify the modification time of all excels in the directory. I want to write a python script. At first I naively thought that renaming would be enough, but in fact it is not possible.
Then I found several libraries for operating excel (openpyxl, xlutils), and wanted to open and save them. The result was that either the xlsx format was not supported or the format was not supported. . In short, there are always some flaws in the format, which will destroy the original style. .
So is there any other way? The effect is equivalent to opening and saving this file (excel)
漂亮男人2017-06-22 11:53:55
os.utime
Help on built-in function utime in module posix:
utime(...)
utime(path, (atime, mtime))
utime(path, None)
Set the access and modified time of the file to the given values. If the
second form is used, set the access and modified times to the current time.
代言2017-06-22 11:53:55
What kind of system is it? If it’s Linux, just touch it directly. You have to go through such trouble