def time24hr(tstr):
if tstr[-2:0] == 'am' and tstr[0:2] == '12':
a = '00' + tstr[3:5] + 'hr'
return a
elif tstr[-2:0] == 'am' and tstr[0:2] != '12':
b = tstr[0:2] + tstr[3:5] + 'hr'
return b
elif tstr[-2:0] == 'pm':
c = str(int(tstr[0:2]) + 12) + tstr[3:5] + 'hr'
return c
我很困惑为什么这个函数不返回字符串,而是显示返回无
慕娘9325324
慕勒3428872
千万里不及你
相关分类