共 5 篇文章 |
|
阅688 转6 评0 公众公开 13-07-05 11:22 |
wxPython是Python编程语言的一个GUI工具箱。比如,希望按F5执行某个操作,可以在__init__函数中使用如下方法:acceltbl = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_F5, self.btnrun.GetId())])self.SetAcceleratorTable(acceltbl)我们知道,有一种非常简单的办法就是使用SetId(wx.ID_CANCEL)方法,如:self.btncancel = wx.Button(self.... 阅517 转0 评0 公众公开 13-06-25 15:48 |
'' + self.logLine print sFailed self.logFile.write(sFailed + ''\n'') self.thLock.release() return None self.thLock.acquire() pagesContent.append(htmlContent) textContent.append(transText) triedUrl.... 阅15019 转238 评5 公众公开 13-02-24 19:54 |
用BeautifulSoup 解析 html文档时,BeautifulSoup将 html文档类似 dom文档树一样处理。>>> html = soup.html>>> html<html><head><title>Page title</title></head><body><p id="firstpara" align="center">This is paragraph<b>one</b>.</p&... 阅927 转1 评0 公众公开 13-02-24 19:53 |
re.findall返回的是字符串中符合results_pat的列表,由于在results_pat中使用了子表达式,所以results存储的就是子表达式所匹配的内容,即<span>与</span>之间的内容。from BeautifulSoup import BeautifulSoupsoup=BeautifulSoup(content)siteUrls=soup.findAll(''span'',attrs={''class'':'... 阅577 转12 评0 公众公开 13-02-24 19:52 |