查找包含多个单词的文件路径

问题描述 投票:0回答:1

我的文件名格式是这样的:

Apple price 04/13-04/15.xlsx
Apple price 04/16-04/18.xlsx
Orange price 04/13-04/15.xlsx

我现在使用以下代码,使用“ Apple”作为过滤器。无论如何,我可以使用双重过滤器(也可以使用04/15作为过滤器)吗?

i = "Apple"
basePath = r'C:\Users\username\Desktop'
glob.glob(os.path.join(basePath,'*{0}*.xls'.format(i)))
python filter path glob
1个回答
0
投票

如果您使用正则表达式(re库)进行过滤,以便可以将它们添加到同一行中,该怎么办。

© www.soinside.com 2019 - 2024. All rights reserved.