我今天已经写了3篇关于pyschools.com练习的帖子,希望不会太多。无论如何,本练习要求我编写一个函数将时间转换为24小时格式。下面是一个例子:>>> time24hr('12:34am') '0034hr‘def time24hr(tstr): first_numbers = tstr[0:2] if am_or_pm == "am":
if fir
请容忍我这一点,因为我可能解释得不太好。^(The\s)?(cat\s)?(sat\s)?(on\s)?(the\s)?(mat\.)?The cat sat on the mat.然而,我所追求的是一种找出regex在哪些组上失败的方法。例如:The cat sat on teh mat. # fails on group 5 (teh instead of the)
The kat sat on the mat.