以下是python3的代码
from dateutil import parser
time_str = "2018 9 03"
dtime = parser.parse(time_str)
print(dtime, type(dtime))
# 2018-09-03 00:00:00
time_str = "2018/9/03"
dtime = parser.parse(time_str)
print(dtime, type(dtime))
# 2018-09-03 00:00:00
time_str = "2018-9-03"
dtime = parser.parse(time_str)
print(dtime, type(dtime))
# 2018-09-03 00:00:00
time_str = "2018-9-03 23:23:9"
dtime = parser.parse(time_str)
print(dtime, type(dtime))
# 2018-09-03 23:23:09