
python
a564941464
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python中input与raw_input区别
input([prompt]) 等同于 eval(raw_input(prompt)).警告:input的输入要求是一个有效的python表达式.文档原文:This function is not safe from user errors! It expects a valid Python expression as input; if the input is not...2011-09-12 18:33:07 · 114 阅读 · 0 评论 -
python中的SocketServer.StreamRequestHandler类中的读写说明
SocketServer.StreamRequestHandler中对客户端发过来的数据是用rfile属性来处理的,rfile是一个类file对象.有缓冲.可以按行分次读取;发往客户端的数据通过wfile属性来处理,wfile不缓冲数据,对客户端发送的数据需一次性写入.如下代码:[code="python"]#! /usr/bin/env python#coding=utf-8''...2011-09-12 21:41:22 · 1075 阅读 · 0 评论 -
pygame示例注释二
[code="java"]#!/usr/bin/env python#coding=utf-8"""Here we load a .TTF font file, and display it ina basic pygame window. It demonstrates several of theFont object attributes. Nothing exciting ...原创 2011-06-20 12:58:47 · 287 阅读 · 0 评论 -
python super()
一、问题的发现与提出 在Python类的方法(method)中,要调用父类的某个方法,在Python 2.2以前,通常的写法如代码段1: 代码段1:[code="python"] class A: def __init__(self): print "enter A" print "leave A" class B(A): def __...原创 2011-06-27 09:36:40 · 103 阅读 · 0 评论 -
python中的拖动源
[code="python"]#coding=utf-8import wxclass DragController(wx.Control): """Just a little control to handle dragging the text from a text control. We use a separate control so as to not i...原创 2011-07-05 00:47:48 · 145 阅读 · 0 评论 -
python 代码片断,查找列表中某个数字的前后数字
[code="python"]#coding=utf-8list=[282435671,2000,9000035401,1,9000035701,2,252444730,3000,9000035601,2,9000035401,1,9000035701,2]mid=input("shu ru mu biao shu zi:")try: index=list.index(mid)...原创 2011-07-05 17:56:32 · 451 阅读 · 0 评论 -
python中的数据结构
1.list 类似java中的list,可以修改已确定的值,通常是用方括号表示 []2.tuple 不知道该类似什么,不可修改已有的值,通常是用圆括号表示 ()3.字典 类似于java中map ,dictionary之类的东西,通过用花括号表示 {},键值之间用冒号 :4.set 类似于java中的s...原创 2011-08-05 11:41:23 · 112 阅读 · 0 评论 -
python抓取指定网址链接并返回网址列表
import urllib2, redef fetch_links(furl,burl,stag,etag): ''' 抓取网页新闻 @param furl 抓取网页地址 @param burl 网页链接的baseurl,比如凤凰网的链接:<a href="/news/guoji/dir?cid=14&amp;mid=7sdLRL">...2012-03-28 17:39:03 · 767 阅读 · 0 评论 -
django 1.3+ 静态资源的访问
说明: 本文django的适用版本是1.3+,在1.4中测试通过. 1. setting.py中DEBUG=True时, 在setting.py中做如下设置: import osSTATIC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pa...原创 2012-03-31 10:16:47 · 172 阅读 · 0 评论