from pathlib import Path

pths = [pth for pth in Path.cwd().iterdir()]

如果是os.listdir()这会返回一个list,文件非常多的时候可能比较耗内存

相关文章:

  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
猜你喜欢
  • 2021-12-06
  • 2022-12-23
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-10-23
相关资源
相似解决方案