应该这样做:
from datetime import datetime
def is_third_friday(s):
d = datetime.strptime(s, '%b %d, %Y')
return d.weekday() == 4 and 15 <= d.day <= 21
测试:
print is_third_friday('Jan 18, 2013') # True
print is_third_friday('Feb 22, 2013') # False
print is_third_friday('Jun 21, 2013') # True
print is_third_friday('Sep 20, 2013') # True