首页 > 编程语言 > 详细

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

时间:2018-11-04 10:31:27      阅读:172      评论:0      收藏:0      [点我收藏+]
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

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

原文:https://www.cnblogs.com/mahaining/p/9902992.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!