# -*- coding: UTF8 -*- import os import time def TimeStampToTime(timestamp): timeStruct = time.localtime(timestamp) return time.strftime('%Y-%m-%d %H:%M:%S', timeStruct) def get_FileModifyTime(filePath): # '''获取文件的修改时间''' # filePath = unicode(filePath, 'utf8') t = os.path.getmtime(filePath) return TimeStampToTime(t) if __name__ == '__main__': path = r"D:\Desktop\kevin_picture_alg_need_collect" print(get_FileModifyTime(path))