【发布时间】:2019-01-04 09:39:40
【问题描述】:
通过提供目录和部分文件名以及扩展名来列出文件的有效方法。
For Ex:- Directory = "/home/Dell/Projects/"
File Name Starts with = "sample_"
Extension = ".csv"
我可能在提到的目录中有以下文件,
1. "/home/Dell/Projects/sample_1.csv"
2. "/home/Dell/projects/sample_2019_01_04.csv"
3. "/home/Dell/Projects/sample_2.pkl"
4. "/home/Dell/Projects/sample_3.txt"
在上面的 4 个文件中,我应该从上面的 python 列表中获取 file.1 和 file.2。
【问题讨论】:
标签: python-3.x file directory