📅  最后修改于: 2022-03-11 14:45:34.170000             🧑  作者: Mango
def timeConversion(s):
suffix = s[-2:]
h_str = s[0:2]
if suffix == 'PM':
hh = int(h_str) % 12 + 12
else:
hh = int(h_str) % 12
return s.replace(h_str, str(hh).zfill(2), 1)[:-2]
s = '12:00:00AM'
print(timeConversion(s))
# output: 00:00:00