python 获取指定文件夹下所以文件

reportPath =文件夹路径
listdir=以一个list返回文件夹下所以文件

dirs = os.listdir(reportPath)
print(dirs)


def __get_report(self):
"""获取最新测试报告"""
dirs = os.listdir(reportPath)
# print(dirs)
dirs.sort() #列表排序
newreportname = dirs[-1]
print('The new report name: {0}'.format(newreportname))
return newreportname

猜你喜欢

转载自www.cnblogs.com/mahaining/p/9902992.html