def getAllImages(folder):
assert os.path.exists(folder)
assert os.path.isdir(folder)
imageList = os.listdir(folder)
imageList = [os.path.abspath(item) for item in imageList if os.path.isfile(os.path.join(folder, item))]
print(imageList[1])
return imageList
print (getAllImages(r"F:\\File_Python\\Python_example\\faceRecognition-master\\Original_picture\\Jason_niu"))

 输出结果

读取成功
Jason_niu
F:\File_Python\Python_example\faceRecognition-master\Jason_niu (1).png
['F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (1).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (1).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (10).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (11).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (12).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (13).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (14).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (15).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (16).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (17).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (18).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (19).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (2).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (2).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (20).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (21).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (22).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (23).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (24).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (25).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (3).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (3).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (4).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (4).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (5).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (5).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (6).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (6).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (7).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (7).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (8).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (8).png', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (9).jpg', 'F:\\File_Python\\Python_example\\faceRecognition-master\\Jason_niu (9).png']

Python封装:实现输出一个文件夹下所有各个文件的地址存为列表集合内——Jason niu的更多相关文章

  1. 递归输出文件夹下的所有文件的名称(转自 MSDN)

    问题:如何输出给定文件夹目录下面的所有文件的名称? C#代码: using System; using System.IO; namespace MyTest { public class Progr ...

  2. 用Java实现将多级文件夹下的所有文件统一放到一个文件夹中

    每次下了电影(男生懂得呦),每部电影都放在一个单独的文件夹里,看的时候很是不方便啊,一直重复着进入文件夹.后退,再进.再退的操作,而手动把这些电影全部复制出来又太繁琐.因此为了解决这个问题,用IO写了 ...

  3. Java遍历一个文件夹下的全部文件

    Java工具中为我们提供了一个用于管理文件系统的类,这个类就是File类,File类与其它流类不同的是,流类关心的是文件的内容.而File类关心的是磁盘上文件的存储. 一,File类有多个构造器,经常 ...

  4. C# 输出文件夹下的所有文件

    问题:如何输出给定文件夹目录下面的所有文件的名称? C#代码: using System; using System.IO; namespace MyTest { public class Progr ...

  5. php 遍历一个文件夹下的所有文件和子文件

    php 遍历一个文件夹下的所有文件和子文件 <?php /** * 将读取到的目录以数组的形式展现出来 * @return array * opendir() 函数打开一个目录句柄,可由 clo ...

  6. Java基础面试操作题: File IO 文件过滤器FileFilter 练习 把一个文件夹下的.java文件复制到另一个文件夹下的.txt文件

    package com.swift; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File ...

  7. python删除某一文件夹下的重复文件

    #2022-10-28 import hashlib import os import time def getmd5(filename): """ 获取文件 md5 码 ...

  8. 读取指定文件夹下的全部文件,可通过正则进行过滤,返回文件路径数组 -- 基于node的一个函数

    var fs = require('fs'); // 模板文件夹路径 var templateDirectory = '../src'; //相对于当前文件的相对路径 //var templateDi ...

  9. 读取某文件夹下所有excel文件 python

    import os import pandas as pd from sklearn import linear_model path = r'D:\新数据\每日收益率' filenames = os ...

随机推荐

  1. 微信小程序 TLS 版本必须大于等于1.2问题解决

    微信小程序  TLS 版本必须大于等于1.2问题解决 此问题最近在微信小程序开发中,比较常见. 在解决这个问题之前,我们需要了解一下,当前的系统环境是否支持TLS1.2以上,可以参考一下表格: 确认系 ...

  2. Tomcat系列(10)——Tomcat主要设计模式5种(外观,责任链,观察者,模板方法,命令模式)

    核心部分 外观模式: RequestFacade应用门面模式(facade)来封装HttpServletRequest. 观察者模式: 事件监听机制,控制组件生命周期的 Lifecycle .Serv ...

  3. 通信传输利器Netty(Net is DotNetty)介绍

    (先埋怨一下微软大大)我们做NET开发,十分羡慕JAVA上能有NETTY, SPRING, STRUTS, DUBBO等等优秀框架,而我们NET就只有干瞪眼,哎,无赖之前生态圈没做好,恨铁不成钢啊.不 ...

  4. java 代码

    java 里的 pandas tablesaw DataFrame 再有就是 spark 了 java 代码规范 Java8特性详解 lambda表达式 Stream Sonar 规则检测 sprin ...

  5. python接收axios的post请求,并处理后返回数据

    公司的python工程师不会js和python数据交互,所以我就去试了一下. 首先安装python,django框架和django-cors-headers. python官网下载,按提示操作,记住最 ...

  6. PaginatorSet

    from django.core.paginator import Paginator, EmptyPage class PaginatorSet: def __init__(self, limit= ...

  7. docker学习------centos7.5下的swarm集群可视化构建

    1.swarm集群 manager : 192.168.211.175 agent1    : 192.168.211.176    agent2    :  192.168.211.177 2.环境 ...

  8. Java虚拟机运行时内存区域简析

    figure:first-child { margin-top: -20px; } #write ol, #write ul { position: relative; } img { max-wid ...

  9. mac下chrome 长截图(不使用插件)

    1. command + option + i (打开windows下的f12): 2. command + shipt + p ; 3. 输入命令: Capture full size screen ...

  10. 文件的暂存(git add)

    如果我们更改了之前已经被跟踪的main.c,然后执行git status $ git status On branch master Changes not staged for commit: (u ...