You can use either datetime or time module to compare two dates. Both modules have function strptime() to convert a string to datetime.
Using datetime:
>>> from datetime import datetime>>> d1 = '2020-03-01'>>> d2 = '2020-04-01'>>> d3 = '2020-05-01'>>> datetime.strptime(d1, "%Y-%m-%d") <= datetime.strptime(d2, "%Y-%m-%d") <= datetime.strptime(d3, "%Y-%m-%d")True
Using time:
>>> import time>>> d1 = '2020-03-01'>>> d2 = '2020-04-01'>>> d3 = '2020-05-01'>>> time.strptime(d1, "%Y-%m-%d") <= time.strptime(d2, "%Y-%m-%d") <= time.strptime(d3, "%Y-%m-%d")True