python读取文件名及后缀 os.listdir()

左先生 2021-04-29 AM 9℃ 0条

语法:os.listdir(path)

函数用途:输出路径下所有文件的文件名

65890-gl4mn7aabm6.png

import os
path = "E:/vs_code/qtVideo/lib"
datanames = os.listdir(path)
for i in datanames:
    print(i)

输出:

A_TEST
OpenCVConfig-version.cmake
OpenCVConfig.cmake
OpenCVModules-debug.cmake
OpenCVModules-release.cmake
OpenCVModules.cmake
opencv_aruco330.lib
opencv_aruco330d.lib
opencv_bgsegm330.lib
opencv_bgsegm330d.lib
opencv_bioinspired330.lib
opencv_bioinspired330d.lib
opencv_calib3d330.lib
opencv_calib3d330d.lib
opencv_ccalib330.lib
opencv_ccalib330d.lib
opencv_core330.lib
opencv_core330d.lib
opencv_datasets330.lib
opencv_datasets330d.lib
opencv_dnn330.lib
opencv_dnn330d.lib
opencv_dpm330.lib
opencv_dpm330d.lib
opencv_face330.lib
opencv_face330d.lib
opencv_features2d330.lib
opencv_features2d330d.lib
opencv_flann330.lib
opencv_flann330d.lib
opencv_fuzzy330.lib
opencv_fuzzy330d.lib
opencv_highgui330.lib
opencv_highgui330d.lib
opencv_imgcodecs330.lib
opencv_imgcodecs330d.lib
opencv_imgproc330.lib
opencv_imgproc330d.lib
opencv_img_hash330.lib
opencv_img_hash330d.lib
opencv_line_descriptor330.lib
opencv_line_descriptor330d.lib
opencv_ml330.lib
opencv_ml330d.lib
opencv_objdetect330.lib
opencv_objdetect330d.lib
opencv_optflow330.lib
opencv_optflow330d.lib
opencv_phase_unwrapping330.lib
opencv_phase_unwrapping330d.lib
opencv_photo330.lib
opencv_photo330d.lib
opencv_plot330.lib
opencv_plot330d.lib
opencv_reg330.lib
opencv_reg330d.lib
opencv_rgbd330.lib
opencv_rgbd330d.lib
opencv_saliency330.lib
opencv_saliency330d.lib
opencv_shape330.lib
opencv_shape330d.lib
opencv_stereo330.lib
opencv_stereo330d.lib
opencv_stitching330.lib
opencv_stitching330d.lib
opencv_structured_light330.lib
opencv_structured_light330d.lib
opencv_superres330.lib
opencv_superres330d.lib
opencv_surface_matching330.lib
opencv_surface_matching330d.lib
opencv_text330.lib
opencv_text330d.lib
opencv_tracking330.lib
opencv_tracking330d.lib
opencv_video330.lib
opencv_video330d.lib
opencv_videoio330.lib
opencv_videoio330d.lib
opencv_videostab330.lib
opencv_videostab330d.lib
opencv_xfeatures2d330.lib
opencv_xfeatures2d330d.lib
opencv_ximgproc330.lib
opencv_ximgproc330d.lib
opencv_xobjdetect330.lib
opencv_xobjdetect330d.lib
opencv_xphoto330.lib
opencv_xphoto330d.lib
标签: python

非特殊说明,本博所有文章均为博主原创。

评论啦~