- 浏览: 250416 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (127)
- vim (3)
- python (44)
- pymysql (1)
- mysql (9)
- macvim (1)
- erlang (3)
- twisted (0)
- tornado (5)
- django (7)
- postgresql (5)
- sql (1)
- java (7)
- tech (4)
- cache (1)
- lifestyle (3)
- html (1)
- ubuntu (2)
- rabbitmq (1)
- algorithm (8)
- Linux (4)
- Pythonista (1)
- thread (1)
- sort (6)
- 设计模式 (1)
- search (1)
- Unix (6)
- Socket (3)
- C (2)
- web (1)
- gc (1)
- php (10)
- macos (1)
最新评论
-
2057:
这个程序有bug。
查找算法学习之二分查找(Python版本)——BinarySearch -
dotjar:
NB
一个Python程序员的进化[转]
简单的web示例:
Resource 官方文档说明:
http://twistedmatrix.com/documents/current/api/twisted.web.resource.Resource.html
#!/usr/bin/python ''' File: simple_web.py Author: Me Description: ''' from twisted.web import server, resource from twisted.internet import reactor class Simple(resource.Resource): isLeaf = True def render_GET(self, request): return "<html>Hello,world!</html>" site = server.Site(Simple()) reactor.listenTCP(8080,site) reactor.run()
#!/usr/bin/python ''' File: simple_web.py Author: Me Description: ''' from twisted.web import server, resource from twisted.internet import reactor class ChildSimple(resource.Resource): isLeaf = True def render_GET(self, request): return "<html>hello,child</html>" class Simple(resource.Resource): def __init__(self): """docstring for __init__""" resource.Resource.__init__(self) self.putChild("", self) self.putChild("child",ChildSimple()) def render_GET(self, request): return "<html>Hello,world!</html>" site = server.Site(Simple()) reactor.listenTCP(8080,site) reactor.run()
Resource 官方文档说明:
http://twistedmatrix.com/documents/current/api/twisted.web.resource.Resource.html
#!/usr/bin/python ''' File: simple_web.py Author: Me Description: ''' from twisted.web import server, resource from twisted.internet import reactor class ChildSimple(resource.Resource): isLeaf = True def __init__(self,id): resource.Resource.__init__(self) self.id=id def render_GET(self, request): return "Hello, No. %s visitor!"% self.id class Simple(resource.Resource): def __init__(self): """docstring for __init__""" resource.Resource.__init__(self) self.putChild("", self) def render_GET(self, request): return "<html>Hello,world!</html>" def getChild(self,path,request): return ChildSimple(path) site = server.Site(Simple()) reactor.listenTCP(8080,site) reactor.run()
发表评论
-
macos 10.9.2 clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command
2014-03-25 19:13 1792方法总是有的,当然需要你去寻找。 当然如果花费太多的时间在一件 ... -
PostgreSQL psycopg2:IndexError: tuple index out of range
2014-01-09 17:04 2246Postgresql psycopg2使用like查询的时候 ... -
Python 迭代器和生成器
2013-10-15 23:09 2867迭代器 迭代器只不过是一个实现迭代器协议的容器对象。它基于两个 ... -
Python时间模块
2013-10-15 23:03 3494time模块 时间模块中最常用的一个函数就是获取当前时间的函数 ... -
Python装饰器
2013-10-15 22:59 1583编写自定义装饰器有许多方法,但最简单和最容易理解的方法是编写一 ... -
python list
2013-10-15 22:56 1274简单总结以及整理如下: >>> dir( ... -
Python Excel
2013-09-10 17:21 992安装lib easy_install xlrd def ... -
排序算法学习(python版本)之堆排序(HeapSort)
2013-07-01 22:54 2020Contains: 堆排序以及堆排序的应用 堆排序(Heaps ... -
python range xrange
2013-06-25 23:30 1183引用Help on built-in function ran ... -
python class
2013-06-25 00:54 1850引用类是创建新对象类 ... -
AttributeError: 'module' object has no attribute 'SendCloud'
2013-06-05 11:46 7119网上查了下 意思是说你命名的文件名不能和lib重名,这样会导 ... -
python string
2013-05-07 23:44 2213如果这就是字符串,这本来就是字符串 首先看下字符串的方法 ... -
Python property
2013-03-29 19:56 0由于之前有总结过,可以参考http://2057.iteye. ... -
python tips
2013-03-28 23:57 8991、enum #!/usr/bin/env python ... -
python decorators
2013-03-28 23:36 1388Contains: 1、decorators 2、funct ... -
python closures
2013-03-28 22:09 1207Closure:如果在一个内部函数里,对在外部作用域(但不是在 ... -
Python map、filter,reduce介绍
2013-03-28 22:02 13361、filter(function,iterable) 引用C ... -
Python __new__ 、__init__、 __call__
2013-03-26 23:49 5377Contains: __new__: 创建对象时调用,返回当 ... -
Python socket简介
2013-03-25 23:42 2199自豪地使用dir和help. Python 2.7.2 ( ... -
Tornado ioloop源码简析
2013-03-21 00:18 2864#!/usr/bin/env python #-*-en ...
相关推荐
Paperback: 270 pages Publisher: Packt Publishing - ebooks... Make your crawler super-fast by learning how to tune Scrapy's performance Perform large scale distributed crawls with scrapyd and scrapinghub
Paperback: 270 pages Publisher: Packt Publishing - ebooks... Make your crawler super-fast by learning how to tune Scrapy's performance Perform large scale distributed crawls with scrapyd and scrapinghub