Can I use greater than less than on dates in Python?

I’m trying to do a comparison between a two specific dates that indicates which is the latter and the former. Can I do it with > and < using an if statement.