其中,\s
为空格
转义、\/
为/
转义,\-
为-
转义
print(re.split(r'[\s\/\-:T]', '1996/6/19 14:20:13'))
print(re.split(r'[\s\/\-:T]', '1996/6/19 14:20'))
print(re.split(r'[\s\/\-:T]', '1996-06-19T14:20:13'))
print(re.split(r'[\s\/\-:T年月日]', '2020年06月23日'))
# ['1996', '6', '19', '14', '20', '13']
# ['1996', '6', '19', '14', '20']
# ['1996', '06', '19', '14', '20', '13']
# ['2020', '06', '23', '', '']