试图从字符串中解析时间,但得到此错误.试过几个格式化字符串.
time data '10/2/2010 0:00:00' does not match format '"%m/%d/%Y %H:%M:%S"'
Run Code Online (Sandbox Code Playgroud)
strdt = '10/2/2010 0:00:00'
dt = datetime.strptime(strdt, '"%m/%d/%Y %H:%M:%S"')
Run Code Online (Sandbox Code Playgroud)
您的格式中包含引号.拿出来.
dt = datetime.strptime(strdt, '%m/%d/%Y %H:%M:%S')
Run Code Online (Sandbox Code Playgroud)