摘要: #coding:utf-8 ''' 折半查找返回值是mid+1 ''' def half_search(data,target): low,high = 0,len(data)-1 while low target: high = mid -1 else: low = mid+1 return 0 d... 阅读全文
posted @ 2016-03-17 15:04 gopher-lin 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 从HTPP站点下载文件 阅读全文
posted @ 2016-03-17 11:21 gopher-lin 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Sockesever模块 阅读全文
posted @ 2016-03-17 10:57 gopher-lin 阅读(136) 评论(0) 推荐(0) 编辑
摘要: # Written by Vamei # A messy HTTP server based on TCP socket import socket # Address HOST = '' PORT = 8080 text_content = ''' HTTP/1.x 200 OK Content-Type: text/html WOW Wow, Python Server F... 阅读全文
posted @ 2016-03-17 10:56 gopher-lin 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 我们写出一个HTTP服务器端: 如我们上面所看到的,服务器会根据request向客户传输的两条信息text_content和pic_content中的一条,作为response文本。整个response分为起始行(start line), 头信息(head)和主体(body)三部分。起始行就是第一行 阅读全文
posted @ 2016-03-17 10:50 gopher-lin 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 在Python中,我们使用标准库中的socket包来进行底层的socket编程。 Client Sever 阅读全文
posted @ 2016-03-17 10:46 gopher-lin 阅读(132) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/coser/archive/2011/12/17/2291160.html 阅读全文
posted @ 2016-03-17 10:26 gopher-lin 阅读(150) 评论(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 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 并发 当有多个线程在操作时,如果系统只有一个CPU,则它根本不可能真正同时进行一个以上的线程,它只能把CPU运行时间划分成若干个时间段,再将时间 段分配给各个线程执行,在一个时间段的线程代码运行时,其它线程处于挂起状。.这种方式我们称之为并发(Concurrent)。 并行: 当系统有一个以上CPU 阅读全文
posted @ 2016-03-17 10:07 gopher-lin 阅读(197) 评论(0) 推荐(0) 编辑
摘要: def fab(n): if n==1: return 1 if n==0: return 0 else: result=int(fab(n-1))+int(fab(n-2)) return resul 阅读全文
posted @ 2016-03-17 09:54 gopher-lin 阅读(154) 评论(0) 推荐(0) 编辑