Python 用什么替换wx.PyLog?

Python 用什么替换wx.PyLog?,python,wxpython,Python,Wxpython,我正在将一些Python代码从2.7移植到3.x。原始代码失败,出现以下错误: class myTextLog(wx.PyLog): AttributeError: 'module' object has no attribute 'PyLog' 检查wx.PyLog是否存在时,它确实不存在: >>> import wx >>> wx.PyLog Traceback (most recent call last): File "<stdi

我正在将一些Python代码从2.7移植到3.x。原始代码失败,出现以下错误:

class myTextLog(wx.PyLog):
AttributeError: 'module' object has no attribute 'PyLog'
检查wx.PyLog是否存在时,它确实不存在:

>>> import wx
>>> wx.PyLog
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PyLog'
>>> wx.version()
u'4.1.0 msw (phoenix) wxWidgets 3.1.4'

沿着这条线的某个地方,它似乎已经被移走了。如果wx.PyLog不再可用,那么什么才是上述代码的合适替代品?

在Python3.x中,您应该使用:
logging

您将想看看

import logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
logging.error('And non-ASCII stuff, too, like Øresund and Malmö')

在Python3.x中,您应该使用:
logging

您将想看看

import logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
logging.error('And non-ASCII stuff, too, like Øresund and Malmö')
import logging
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')
logging.error('And non-ASCII stuff, too, like Øresund and Malmö')