首页 > 代码库 > 安装PyQt

安装PyQt

下载PyQt(版本一定要对)

http://www.riverbankcomputing.com/software/pyqt/download

 

import sys,urllib2from HTMLParser import HTMLParserfrom PyQt4.QtCore import *from PyQt4.QtGui import *from PyQt4.QtWebKit import *class Render(QWebPage):    def __init__(self, url):      self.app = QApplication(sys.argv)      QWebPage.__init__(self)      self.loadFinished.connect(self._loadFinished)      self.mainFrame().load(QUrl(url))      self.app.exec_()      def _loadFinished(self, result):      self.frame = self.mainFrame()      self.app.quit()    url = ‘http://888.qq.com/v1.0/buy/jczq.shtml#spf_gg‘  r = Render(url)  html = r.frame.toHtml()print html.toUtf8()# 将执行后的代码写入文件中f = open(‘./test.txt‘,‘w‘)f.write(html.toUtf8())f.close()

  

安装PyQt