Message317541
I have to process some data which date was specified in 12-hour format, eg. 9/24/2017 0:39:41 PM.
I call datetime.datetime.strptime with "%m/%d/%Y %I:%M:%S %p" format.
However, it throws me an error [File "C:\Python27\lib\_strptime.py", line 332, in _strptime (data_string, format)) ValueError: time data '9/24/2017 0:39:41 PM' does not match format '%m/%d/%Y %I:%M:%S %p'].
Then, I found out that, in _strptime.py, the regex patterns are defined as below.
'd': r"(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])",
'f': r"(?P<f>[0-9]{1,6})",
'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])",
'j': r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])",
'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",
'M': r"(?P<M>[0-5]\d|\d)",
'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
'w': r"(?P<w>[0-6])",
I'm a newbie in python world. Is it a bug?
I changed regex pattern of 'I' to r"(?P<I>1[0-2]|0[0-9]|[0-9])" and it works.
I would like to know why 0 is excluded.
May be, I have missed something. |
|
Date |
User |
Action |
Args |
2018-05-24 07:29:39 | CatPaw Freed | set | recipients:
+ CatPaw Freed |
2018-05-24 07:29:39 | CatPaw Freed | set | messageid: <1527146979.67.0.682650639539.issue33631@psf.upfronthosting.co.za> |
2018-05-24 07:29:39 | CatPaw Freed | link | issue33631 messages |
2018-05-24 07:29:39 | CatPaw Freed | create | |
|