简体   繁体   English

glob.glob 不返回完全限定路径中的任何文件?

[英]glob.glob does not return any files in a fully qualified path?

Note: the similarly named question Python glob.glob always returns empty list has different concrerns about relative pathname.注意:类似名称的问题Python glob.glob 总是返回空列表相对路径名有不同的关注。 Mine is a fully qualified path.我的路径是完全合格的。

I am trying to list the files in a directory of the stanford dogs dataset:我正在尝试列出stanford dogs数据集目录中的文件:

$ls /data/stanforddogs/Annotation/n02097658-silky_terrier/* | wc -l
    183

Why is glob not finding these files为什么glob找不到这些文件

import glob
for f in glob.glob('/data/stanforddogs/Annotation/n02097658-silky_terrier/*'):
  print(f)

This returns no entries.这不返回任何条目。 Why is that?这是为什么? I am on macOS on python3.8我在python3.8上的macOS

This appears to be a bug in the "Evaluate expression" feature of pycharm : nothing is found there.这似乎是pycharm的“评估表达式”功能中的一个错误:在那里找不到任何东西。 Running the same code within the "Execute selection within python console" does work.在“在 python 控制台中执行选择”中运行相同的代码确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM