for files in os.walk("Path of a directory"):
for file in files:
print(os.path.getmtime(os.path.abspath(file)))
我想打印目录中所有文件的修改时间。为什么会出现此错误?
Traceback (most recent call last):
File "L:/script/python_scripts/dir_Traverse.py", line 7, in <module>
print(os.path.getmtime(os.path.abspath(file)))
File "C:\Python27\lib\ntpath.py", line 488, in abspath
path = _getfullpathname(path)
TypeError: coercing to Unicode: need string or buffer, list found