随笔分类 -  python

摘要:我们写出一个HTTP服务器端: 如我们上面所看到的,服务器会根据request向客户传输的两条信息text_content和pic_content中的一条,作为response文本。整个response分为起始行(start line), 头信息(head)和主体(body)三部分。起始行就是第一行 阅读全文
posted @ 2016-03-17 10:50 gopher-lin 阅读(233) 评论(0) 推荐(0)
摘要:在Python中,我们使用标准库中的socket包来进行底层的socket编程。 Client Sever 阅读全文
posted @ 2016-03-17 10:46 gopher-lin 阅读(137) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/coser/archive/2011/12/17/2291160.html 阅读全文
posted @ 2016-03-17 10:26 gopher-lin 阅读(160) 评论(0) 推荐(0)
摘要:在 java web 领域,支持 servlet API 的 java application 都可运行在支持 servlet API 的 web server (http server) 上。随着 web 不断发展,python application/framework 也如雨后春笋般涌出,如: 阅读全文
posted @ 2016-03-17 10:14 gopher-lin 阅读(187) 评论(0) 推荐(0)
摘要:#coding:utf-8 def demo(data,temp): for i in range(len(data)-1): if data[i] == temp : print i break else: print u'没有满足条件的数字' if __name__ == "__... 阅读全文
posted @ 2016-03-16 17:11 gopher-lin 阅读(92) 评论(0) 推荐(0)
摘要:http://python.jobbole.com/81478/ 阅读全文
posted @ 2016-03-16 16:01 gopher-lin 阅读(117) 评论(0) 推荐(0)
摘要:#coding:utf-8 import htmllib import httplib2 import httplib h1 = httplib.HTTPConnection("www.python.org") h1.request("GET", "/") r1 = h1.getresponse() print r1.status, r1.reason data1 = r1.read() ... 阅读全文
posted @ 2016-03-16 16:00 gopher-lin 阅读(151) 评论(0) 推荐(0)
摘要:学习: 阅读全文
posted @ 2016-03-16 15:01 gopher-lin 阅读(279) 评论(0) 推荐(0)
摘要:http://python.jobbole.com/84153/ 阅读全文
posted @ 2016-03-16 14:36 gopher-lin 阅读(176) 评论(0) 推荐(0)
摘要:hello world的程序实现 import tornado.ioloop import tornado.web class MainHalder(ornado.web.RequestHandler): def get(self): self.wirte('hello,world') def ma 阅读全文
posted @ 2016-03-14 12:31 gopher-lin 阅读(120) 评论(0) 推荐(0)
摘要:Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non blocking network I/O, Tornado 阅读全文
posted @ 2016-03-14 12:28 gopher-lin 阅读(123) 评论(0) 推荐(0)
摘要:最近在使用python做接口测试,发现python中http请求方法有许多种,今天抽点时间把相关内容整理,分享给大家,具体内容如下所示: 一、python自带库 urllib2 python自带库urllib2使用的比较多,简单使用如下: import urllib2 response = urll 阅读全文
posted @ 2016-02-23 16:49 gopher-lin 阅读(347) 评论(0) 推荐(0)
摘要:tail /var/log/apache2/error.log ssh root@114.215.93.125 scp r /Users/Fiz/Documents/blog root@114.215.93.125:/home/ CREATE DATABASE Blog DEFAULT CHARAC 阅读全文
posted @ 2016-02-23 14:00 gopher-lin 阅读(107) 评论(0) 推荐(0)
摘要:!/usr/bin/env python coding: UTF 8 from sqlalchemy.orm import mapper, sessionmaker __author__ = 'tan9le' from sqlalchemy import create_engine, Ta... 阅读全文
posted @ 2016-01-26 11:07 gopher-lin 阅读(271) 评论(0) 推荐(0)
摘要:coding:utf 8'''数字http://blog.csdn.net/hdutigerkin/article/details/6694884ceil(x) 取顶floor(x) 取底fabs(x) 取绝对值factorial (x) 阶乘hypot(x,y) sqrt(x x+y y)pow... 阅读全文
posted @ 2016-01-21 14:15 gopher-lin 阅读(181) 评论(0) 推荐(0)
摘要:关键字参数:把参数名与值绑定在一起,使用参数名提供的参数叫做关键字参数。设置关键字参数默认值。 位置参数:带单个星号参数(以元祖形式输出) 关键字参数:带两个星号参数《以字典形式输出, 是一个元组类型的数值 def funcD(a, b, c): print a print b print ... 阅读全文
posted @ 2016-01-21 10:22 gopher-lin 阅读(635) 评论(0) 推荐(0)
摘要:metaclass的原理其实是这样的:当定义好类之后,创建类的时候其实是调用了type的__new__方法为这个类分配内存空间,创建 好了之后再调用type的__init__方法初始化(做一些赋值等)。所以metaclass的所有magic其实就在于这个__new__方法里面了。 说说这个方法:__... 阅读全文
posted @ 2016-01-21 10:03 gopher-lin 阅读(351) 评论(0) 推荐(0)
摘要:激活虚拟环境 eval "$(pyenv init )" pyenv activate 阅读全文
posted @ 2016-01-18 17:43 gopher-lin 阅读(114) 评论(0) 推荐(0)
摘要:setup tools安装 curl https://bootstrap.pypa.io/ez_setup.py o | python mysqldb(mac) 建议版本选择1.2.3 https://pypi.python.org/pypi/MySQL python/ 先下载源码,修改site... 阅读全文
posted @ 2016-01-17 22:28 gopher-lin 阅读(131) 评论(0) 推荐(0)