您正在查看 "Python" 分类下的文章
2009-05-14 01:48
#!/usr/bin/python
import urllib
import re
def getss(id):
urlbase = 'http://acm.pku.edu.cn/JudgeOnline/userstatus?user_id='
url = urlbase + id
html = urllib.urlopen(url)
rs = re.search(r'<td align=center width=25%><a href=status\?result=0&user_id=.*>(\d+)</a></td>', html.read())
if rs:
|
2009-03-03 23:55
url : http://www.pythonchallenge.com
第0关:
print 2 ** 35
第1关:
string.translate()
string.maketrans()
第2关:
正规表达式:
reobj = re.compile('[a-zA-Z]+')
reobj.findall(string)
第3关:
reobj = re.compile('[a-z]+[A-z]{3,3}[a-z][A-Z]{3,3}[a-z]+')
reobj.findall(string)
第4关:
import re
import urllib2
urlbase = 'http://www.pythonchallenge.com/pc/ |
2009-02-26 15:32
其实我早就看到了这个插件了,装上后发现作者是用的python2.4,在python2.5下只有一个功能能用(总共也只有三个功能^-^)
看到有人在fanfou上找vim的fanfou插件, 我又把这个插件找了出来,花时间改了一下,基本能用了!
主要是两处编码问题!
还剩下的问题是解析消息时间的问题了!
python需要simplejson模块,经过试用只在linux下有用!
下载地址:
http://www.drivehq.com/file/df.aspx/shareID54373 |
2008-10-20 18:26
;;;有好几处的数学术语,翻译不了!~汗!
通过15个练习题学习一种新的语言
作者 Prashant N Mhatre
我有很多和很多编程语言相关的工作经验,但是工作经常要求在短时间内学习一门新的语言.我并不去阅读几百页的手册,取而代之的是我仅仅去读
只有10到15页长的入门指南或教程.(google是查找这类资料的最好的搜索引擎!).我把印有语言语法的卡片放在手边(在网上有很多的这类手册卡片,google 你要学的语言名字 + reference card)
首先,你要熟悉编译器,编译器的选项,编辑器的快捷键,或者一个IDE.你可以用 |
2008-08-20 11:25
GUI编程要做的4件事:
1)决定程序看起来像什么样,look
2)决定程序要做些什么,do
3)将程序的外观和正在做的事联系起来
4)处理用户的输入
GUI的一些术语:
组件(控件)
控件属性
控件方法
事件
事件循环
事件处理函数(回调函数)
绑定
几何管理系统(grid(),pack(),place()) 注意 : 这三个不能混合着用!grid()的灵活性最大,place()常 用!
容器
父对象(不能这么叫)
设定控件属性的3种方法:
1)button = Button(frame,width = 6, cursor = |
2008-08-19 10:46
In the previous program, we looked at a technique involving lambda to pass arguments to an event-handler function. In this program, we will look at a different technique, called "currying".
About Curry
In its very simplest sense, currying is a technique for using a function to construct other functions.
Currying is a technique borrowed from functional programming. If you would like to learn more about currying, there are several reci |
2008-08-18 15:35
Some Gui-programming Jargon
GUI (graphical user interface) programming has some special jargon associated with these basic tasks.
1) We specify how we want a GUI to look by describing the "widgets" that we want it to display, and their spatial relationships (i.e. whether one widget is above or below, or to the right or left, of other widgets). The word "widget" is a nonsense word that has become the common term for "graphical |
2008-08-15 14:29
写些小程序来学习python!
1 #!/usr/bin/python
2 #*-*encoding:utf-8*-*
3 |
|
| |