azev
V2EX  ›  问与答

问个 Python 的列表生成式 循环目录列表 返回每个目录及目录下第一个文件

  •  
  •   azev · Nov 30, 2022 · 967 views
    This topic created in 1441 days ago, the information mentioned may be changed or developed.

    能不能搞成?

    azev
    azev
    OP
    Nov 30, 2022
    1
    原来不麻烦 return [(dir,os.listdir(dir)[0]) for dir in dirList ]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2338 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:32 · PVG 19:32 · LAX 03:32 · JFK 06:32
    ♥ Do have faith in what you're doing.