#!/usr/bin/python3.5
import os
import re
dir_bams = '/data/tmp'
for f in os.listdir(dir_bams):
if re.search('\.bam$', f) and os.path.isfile(f):
print(f)
————————————————
链接: https://www.cnblogs.com/jhao/p/7243043.html
判断文件类型,以及读写权限
本文介绍了一个使用Python编写的简单脚本,该脚本能够遍历指定目录并列出所有以.bam结尾的文件。通过正则表达式和os模块的功能实现了文件类型的过滤及路径检查。
2028

被折叠的 条评论
为什么被折叠?



