使用Glob检查每个导演中的每个文件

发布于 2025-01-26 01:37:13 字数 451 浏览 1 评论 0原文

因此,我对Glob有一个问题,即它为我进行的任何搜索返回一个空列表[]。我认为这是因为我在错误的目录中。因此,我将如何使用Glob搜索记录下的所有文件。 (请参阅图像)我试图找到所需日期的出勤记录。 (他们通过日期,搜索并返回其中的数据(使用PD))

我尝试过的内容:

gen = glob.iglob(date)
for x in gen:
     print(x)

“在此处输入图像说明”

So I have a problem with glob that it returns an empty list [] for any search I do. I assume it is because I am in the wrong directory. So How would I use glob to search all the files under records. (see image) I am trying to find the attendance records for the desired date. (They pass in date, it searches, and returns the data in it (using pd))

What I have tried:

gen = glob.iglob(date)
for x in gen:
     print(x)

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

腻橙味 2025-02-02 01:37:13
for f in glob.glob(f'/{dir}/**/{date}', recursive=True):
          print(f)
          pd.read_csv(file)

这最终为我锻炼。 :d

for f in glob.glob(f'/{dir}/**/{date}', recursive=True):
          print(f)
          pd.read_csv(file)

This ended up working out for me. :D

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文