看看这段Python代码问题出在哪
照着书上写的,执行时报错(Python2.6)
import wx
class InsertFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Frame With Button',size=(300,100))
panel = wx.Panel(self)
button = wx.Button(panel,label="Close",pos=(125,20),
size=(50,50))
self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button)
self.Bind(wx.EVT_CLOSE,self.OnCloseWindow)
def OnCloseMe(self,event):
self.Close(True)
def OnCloseWindow(self,event):
self.Destroy()
if __name__=='__main__':
app = wx.PySimpleApp()
frame = InsertFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()
报错信息如下:
Traceback (most recent call last):
File "D:\Python26\test\wx\button.py", line 19, in <module>
frame = InsertFrame(parent=None,id=-1)
File "D:\Python26\test\wx\button.py", line 4, in __init__
wx.Frame.__init__(self,parent,id,'
相关问答:
RT,貌似Python之父也说如果你现在开始新的项目的话,最好是直接使用Python3,可是实际上大家使用得大部分还是2.5,估计用2.6的都不是很多,并且相对应的许多扩展都没有3对应的版本。
  ......
有这么一个版本号的list
version = ['1.0.1', '1.0.2', '1.0.21', '1.2.9', '1.2.11']
我怎么样能对版本号的大小进行排序,获得最大的版本号(1.2.11)
max 或者sor ......
聊聊,我一直不是很理解为什么动态语言就不需要接口,我只是从建模的角度考虑,接口是一种合理的建模方式呀,特别是大的项目,而且代码容易维护。相比接口多重继承是一种很糟糕的方式。为什么动态语言就不需要接口, ......
d = {"a":"a","b":"b","c":"c"}
print d
为什么输出是:{'a': 'a', 'c': 'c', 'b': 'b'} ......
前几天刚刚接触Python,好多问题不明白
代码如下,可以正常输出sheetname.如果把编码方式改成utf16就会报错
TypeError: compile() expected string without null bytes
请问是为什么?
还有输出地内容是 ......