我有大量的文件,文件名中嵌入了日期。我将文件解析为dict,其中键是从名称中提取的日期时间,值是路径。
我想从日期时间介于时间A和时间B之间的集合中选择所有文件。
我的第一个想法是将字典转换为元组列表,然后进行排序。
file_list = [(k, v) for k, v in file_dict.items()]
file_list = sorted(file_list, key = lambda x: x[0])
然后我将使用for循环从两个点之间的列表中进行选择。
first = -1
last = -1
for i in range(len(file_list)):
if f
我目前正在开发一个用作待办事项列表的应用程序,我想知道如何接受日期时间框中的值,而只使用日期值或时间值。我现在是这样做的。
DateTime ted = appointmentDateTimeDate.Value; //The date
DateTime at = appointmentDateTimeTime.Value; //The time
我应该用另一种方式来做这件事吗?