Python:datetime.strTime在使用wx时出错

Python:datetime.strTime在使用wx时出错,python,wxpython,python-datetime,Python,Wxpython,Python Datetime,我发现了一只奇怪的虫子。 当我使用库wx时,来自datetime库的函数strTime不起作用 例如: from datetime import datetime myDate2= datetime.strptime('Wed Feb 19 14:57:58 2020', '%a %b %d %H:%M:%S %Y') 当我执行前面的代码和wx.app()时,出现以下错误: myDate2= datetime.strptime('Wed Feb 19 14:57:58 2020', '%a %

我发现了一只奇怪的虫子。 当我使用库wx时,来自datetime库的函数strTime不起作用

例如:

from datetime import datetime
myDate2= datetime.strptime('Wed Feb 19 14:57:58 2020', '%a %b %d %H:%M:%S %Y')
当我执行前面的代码和wx.app()时,出现以下错误:

myDate2= datetime.strptime('Wed Feb 19 14:57:58 2020', '%a %b %d %H:%M:%S %Y') 
Traceback (most recent call last):

File "<ipython-input-108-b41842200da1>", line 1, in <module>
myDate2= datetime.strptime('Wed Feb 19 14:57:58 2020', '%a %b %d %H:%M:%S %Y')

File "C:\Simu\WinPython_3741\python-3.7.4.amd64\Lib\_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)

File "C:\Simu\WinPython_3741\python-3.7.4.amd64\Lib\_strptime.py", line 359, in _strptime
(data_string, format))

ValueError: time data 'Wed Feb 19 14:57:58 2020' does not match format '%a %b %d %H:%M:%S %Y'
myDate2=datetime.strtime('Wed Feb 19 14:57:58 2020','%a%b%d%H:%M:%S%Y')
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
myDate2=datetime.strTime('Wed Feb 19 14:57:58 2020','%a%b%d%H:%M:%S%Y')
文件“C:\Simu\WinPython\u 3741\python-3.7.4.amd64\Lib\ \u strtime.py”,第577行,在_strtime\u datetime中
tt,分数,gmtoff\u分数=\u strTime(数据字符串,格式)
文件“C:\Simu\WinPython\u 3741\python-3.7.4.amd64\Lib\\u strtime.py”,第359行,在"strtime"中
(数据字符串,格式))
ValueError:时间数据“Wed Feb 19 14:57:58 2020”与格式“%a%b%d%H:%M:%S%Y”不匹配
datetime和wx之间有什么联系? 如何修复此错误?

已解决

这个bug来自localtime。我不知道为什么,但当我执行wx.app()时,我的本地时间会改变

由于以下命令,我发现了这一点:

从时间导入strftime,localtime
打印(strftime(“%H:%M,%d%B%Y”,localtime()))
2020年费维尔20日10:44

要更改localtime,请执行以下代码:

import locale
locale.setlocale(locale.LC_ALL, 'en_US')

你能分享整个故事吗traceback@Jeril对完成了