标签: python filenames
我想获取根文件夹中特定extension的所有文件的完整路径,这是我尝试过的(当前仅文件名没有完整路径):
extension
xmls = r'C:\xmls' included_extensions = ['xml'] file_names = [fn for fn in os.listdir(xmls) if any(fn.endswith(ext) for ext in included_extensions)]