azev
V2EX  ›  问与答

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

  •  
  •   azev · Nov 30, 2022 · 978 views
    This topic created in 1456 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   ·   1061 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 18:40 · PVG 02:40 · LAX 10:40 · JFK 13:40
    ♥ Do have faith in what you're doing.