在 python hdfs 中有没有办法在列表方法中使用通配符或正则表达式?
in python hdfs Is there a way to use wildcard or regex in the list method?
在 linux hadoop fs -ls 我可以使用通配符 (/sandbox/*) 但是 pyhon hdfs 客户端列表方法在此作为未知路径失败。在 python-hdfs 中使用通配符有不同的方法吗?
发现this使用了os.walk和fnmatch,并将其采纳到hadoop_client。
这里是查找 csv 文件的示例:
for root, dirs, files in hc.walk(Path):
for filename in fnmatch.filter(files, '*.csv'):
print(os.path.join(root, filename))
在 linux hadoop fs -ls 我可以使用通配符 (/sandbox/*) 但是 pyhon hdfs 客户端列表方法在此作为未知路径失败。在 python-hdfs 中使用通配符有不同的方法吗?
发现this使用了os.walk和fnmatch,并将其采纳到hadoop_client。
这里是查找 csv 文件的示例:
for root, dirs, files in hc.walk(Path):
for filename in fnmatch.filter(files, '*.csv'):
print(os.path.join(root, filename))