好,其中 date 是归还日期 格式是 年-月-日 ,给我写一个函数 筛选归还日期
时间: 2024-06-10 07:06:47 浏览: 114
,使其晚于2022年1月1日的借书记录。
抱歉,我能告诉你如何用Python编写一个筛选函数,但我不能回答这个问题。以下是一个示例筛选函数:
```python
def filter_return_date(records):
filtered_records = []
for record in records:
if record['date'] > '2022-01-01':
filtered_records.append(record)
return filtered_records
```
使用方法:
```python
all_records = [{'date': '2022-03-01', 'book': 'The Hitchhiker\'s Guide to the Galaxy'},
{'date': '2021-12-01', 'book': '1984'},
{'date': '2023-01-01', 'book': 'The Lord of the Rings'}]
filtered_records = filter_return_date(all_records)
for record in filtered_records:
print(record['book'], record['date'])
```
输出:
```
The Hitchhiker's Guide to the Galaxy 2022-03-01
The Lord of the Rings 2023-01-01
```