根据时间提取介于某个时间段的信息 分类: python基础学习 2013-08-16 17:26 311人阅读 评论(0) 收藏
16:01:02 djflajdflasjdfla1
16:02:04 djflajdflsdasjdfla2
16:03:09 djflassjdfla3
16:04:03 djflajdflsdasjdfla4
16:05:02 djflajdflasjdfla5
16:06:22 djflajdafla6
16:07:02 djflajsaaasasjdfla7
16:08:02 djflajdsasjdfla8
16:08:12 djflajdsasjdfla9
16:09:33 djflajdfslasjdfla10
16:11:06 djflajdfsdflasjdfla11
16:22:52 djflajdbbbasjdfla12
16:34:42 djflajdcccdfla13
17:05:07 djflajdflsssjdfla14
17:09:02 djflajdfyrrrdfla15
16:02:04 djflajdflsdasjdfla2
16:03:09 djflassjdfla3
16:04:03 djflajdflsdasjdfla4
16:05:02 djflajdflasjdfla5
16:06:22 djflajdafla6
16:07:02 djflajsaaasasjdfla7
16:08:02 djflajdsasjdfla8
16:08:12 djflajdsasjdfla9
16:09:33 djflajdfslasjdfla10
16:11:06 djflajdfsdflasjdfla11
16:22:52 djflajdbbbasjdfla12
16:34:42 djflajdcccdfla13
17:05:07 djflajdflsssjdfla14
17:09:02 djflajdfyrrrdfla15
我要过虑出16:02到17点05这段内容,谁有好的方法么!
import fileinput
import time
def p(line):
return time.strptime(line.split()[0], "%H:%M:%S")
start, end = p("16:02:00"), p("17:05:00")
for line in fileinput.input():
if start <= p(line) < end:
print line