import datetime
"""
当前时间与开始时间、结束时间比较
time格式 '2018-01-03 16:26:23'
"""
def compare_time(startTime,endTime):
now = datetime.datetime.now ()
d_start = datetime.datetime.strptime (startTime, '%Y-%m-%d %H:%M:%S')
d_end = datetime.datetime.strptime (endTime, '%Y-%m-%d %H:%M:%S')
result = (d_start<=now) and (d_end>=now)
return result
result = compare_time('2018-01-03 16:26:23','2018-02-03 16:29:55')
print(result)
'''