Look at the Python code:
base = ['2018-1-9', '2017-1-1', '2017-4-10', '2015-2-15', '2017-12-31', '2018-1-8', '2017-12-31', '2017-4-10', '2017-3-16']
for item in base:
if item <= '2017-12-31':
print(item)
This results in
2017-1-1
2015-2-15
2017-12-31
2017-12-31
I want to print all the dates in 2017:
2017-1-1
2017-4-10
2017-12-31
2017-12-31
2017-4-10
2017-3-16
What needs to be changed in my code?