1 传入一个字符串,输出它对应于当天的第几分钟
def getminutes(t):
'''
t : type:'str'
'''
x=time.strptime(t,'%H:%M')
print('x = ',x)
return x[3]*60+x[4]
eg:
t = '20:45'
value = getminutes(t)
print('The time: %s is %dth minutes of the day' %(t,value))
[out]:
x = time.struct_time(tm_year=1900, tm_mon=1, tm_mday=1, tm_hour=20, tm_min=45, tm_sec=0, tm_wday=0, tm_yday=1, tm_isdst=-1)
The time: 20:45 is 1245th minutes of the day
`