【问题标题】:How to find what files are in a folder [duplicate]如何查找文件夹中的文件[重复]
【发布时间】:2013-11-14 09:38:00
【问题描述】:

我正在编写一个接收文件夹路径作为参数的函数。我希望她将文件夹内的内容添加到字典中(如 CMD 中的 dir)

我该怎么做?

提前谢谢你, 伊利亚

【问题讨论】:

标签: python directory


【解决方案1】:
import os
print os.listdir('/tmp')

类似主题:

Directory listing in Python

另外,我经常使用os.pathglob,而manipulating file system path。 你可能想检查一下。

【讨论】:

  • 写一个答案并链接一个问题,清楚地表明这个问题是重复的,这对我来说有点不连贯。您应该将此问题标记为“Python 中的目录列表”的副本,并最终添加更多信息作为评论。
猜你喜欢
  • 2021-11-28
  • 1970-01-01
  • 1970-01-01
  • 2015-07-12
  • 2014-02-16
  • 2019-01-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多