随笔分类 -  Python

摘要:import sys from PyQt4 import QtCore, QtGui app = QtGui.QApplication(sys.argv) widget = QtGui.QWidget() widget.resize(600, 400) edit = QtGui.QTextEdit() btn1=QtGui.QPushButton("button1") btn2=QtGui... 阅读全文
posted @ 2017-09-23 10:52 Dsp Tian 阅读(635) 评论(0) 推荐(0)
摘要:import sys from PyQt4 import QtCore, QtGui class myWidget(QtGui.QWidget): def __init__(self): super(myWidget, self).__init__() self.setWindowTitle("test") self.resize(30... 阅读全文
posted @ 2017-09-23 10:52 Dsp Tian 阅读(684) 评论(0) 推荐(0)
摘要:环境:windows7+python2.7+PyQt4 阅读全文
posted @ 2017-09-23 10:51 Dsp Tian 阅读(679) 评论(0) 推荐(0)
摘要:from HTMLParser import HTMLParserimport sysclass TitleParser(HTMLParser): def __init__(self): self.title = '' self.readingtitle=0 HTMLParser.__init__(self) def handle_starttag(self, tag, attrs): if tag == 'title': self.readingtitle=1 def handle_data(se... 阅读全文
posted @ 2012-06-14 12:45 Dsp Tian 阅读(2088) 评论(0) 推荐(0)
摘要:import os,sys, urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)file=open('123.html','w')while 1: data=fd.read(1024) if not len(data): break #sys.stdout.write(data) file.write(data)file.close() 阅读全文
posted @ 2012-06-13 15:35 Dsp Tian 阅读(635) 评论(0) 推荐(0)
摘要:import osfile=open("123.txt","r")for line in file.readlines(): print line,file.close()file=open("123.txt","w")file.write("sdfsdfsdf")file.close()file=open("123.txt","a")file.write("erertyerty")file.close()file=open(" 阅读全文
posted @ 2012-06-12 20:44 Dsp Tian 阅读(753) 评论(0) 推荐(0)
摘要:import mathprint 12*34+78-132/6print (12*(34+78)-132)/6print (86/40)**5print math.fmod(145,23)print math.sin(0.5)print math.cos(0.5)a=1+2c=4print "1+2=%d" %aprint "1+2=%d,%d" %(a,c) 阅读全文
posted @ 2012-06-11 22:00 Dsp Tian 阅读(601) 评论(0) 推荐(0)
摘要:import time#n=input("input a year:")n=time.localtime()[1]'''if n%400==0 or (n%4==0 and n%100!=0): print "yes"else: print "not"'''print n 阅读全文
posted @ 2012-06-11 21:48 Dsp Tian 阅读(814) 评论(0) 推荐(0)