擅长:python、mysql、java
<p>您可以使用<a href="http://docs.python.org/2/library/datetime.html" rel="noreferrer">^{<cd1>}</a>模块将它们全部转换为datetime对象。您正在比较示例中的字符串:</p>
<pre><code>>>> from datetime import datetime
>>> date1 = datetime.strptime(date1, "%d/%m/%Y")
>>> date2 = datetime.strptime(date2, "%d/%m/%Y")
>>> date3 = datetime.strptime(date3, "%d/%m/%Y")
>>> date4 = datetime.strptime(date4, "%d/%m/%Y")
>>> datelist = [date1, date2, date3]
>>> for j in datelist:
... if j <= date4:
... print(j.strftime('%d/%m/%Y'))
...
20/06/2013
25/06/2013
01/07/2013
</code></pre>