摘要: import urllib.requesturl = 'site'headers = {'Authorization' : 'Basic emVkMHg6WWJyYm5mMDA='}req = urllib.request.Request(url, headers)response = urllib... 阅读全文
posted @ 2015-01-26 11:14 arhatlohan 阅读(1368) 评论(0) 推荐(0) 编辑
摘要: 感谢:http://www.cnblogs.com/codingmylife/archive/2010/06/06/1752807.html1.性能Py3.0运行 pystone benchmark的速度比Py2.5慢30%。Guido认为Py3.0有极大的优化空间,在字符串和整形操作上可以取得很好... 阅读全文
posted @ 2015-01-25 16:05 arhatlohan 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 一、列表一组有序项目的集合。可变的数据类型【可进行增删改查】列表是以方括号“[]”包围的数据集合,不同成员以“,”分隔。列表中可以包含任何数据类型,也可包含另一个列表列表可通过序号访问其中成员常用列表操作:list.append()追加成员,成员数据list.pop()删除成员,删除第i个成员lis... 阅读全文
posted @ 2015-01-25 15:26 arhatlohan 阅读(274) 评论(0) 推荐(0) 编辑
摘要: TCP数据包中的序列号(Sequence Number)不是以报文段来进行编号的,而是将连接生存周期内传输的所有数据当作一个字节流,序列号就是整个字节流中每个字节的编号。一个TCP数据包中包含多个字节流的数据(即数据段),而且每个TCP数据包中的数据大小不一定相同。在建立TCP连接的三次握手... 阅读全文
posted @ 2015-01-11 21:04 arhatlohan 阅读(2148) 评论(0) 推荐(0) 编辑
摘要: TCP三次握手Three-way Handshake一个虚拟连接的建立是通过三次握手来实现的1. (B) --> [SYN] --> (A)假如服务器A和客户机B通讯. 当A要和B通信时,B首先向A发一个SYN (Synchronize) 标记的包,告诉A请求建立连接.注意: 一个 SYN包就是仅S... 阅读全文
posted @ 2015-01-11 20:53 arhatlohan 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 感谢:http://www.cnblogs.com/renrenqq/archive/2010/09/09/1813669.html不过里面有些错误,以及不足的地方,现将流程记录如下:下载安装Python。从Vim的网站下载vim,建议下Self-installing executable的版本。编... 阅读全文
posted @ 2015-01-06 11:36 arhatlohan 阅读(524) 评论(0) 推荐(0) 编辑
摘要: vmware 虚拟机长时间不用,恢复快照时出现如下错误:An error caused the restore operation to fail. Cancel the restore operation and correct the .....Discard...Cancel....度娘没有解... 阅读全文
posted @ 2014-10-23 16:42 arhatlohan 阅读(297) 评论(0) 推荐(0) 编辑
摘要: #WalkDir函数枚举目录中所有目录和文件,参数(枚举目录输出列表,枚举文件输出列表,要枚举的目录)def WalkDir(dirlist,filelist,dirname): try: ls=os.listdir(dirname) except: prin... 阅读全文
posted @ 2014-10-22 22:10 arhatlohan 阅读(2327) 评论(0) 推荐(0) 编辑
摘要: 1. 最基本的读文件方法:file = open("sample.txt") while 1: line = file.readline() if not line: break pass # do something 一行一行得从文件读数据,显然比较慢;不过很省内... 阅读全文
posted @ 2014-10-20 17:18 arhatlohan 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 一、单行注释单行注释以#开头,例如:print 6#输出6二、多行注释(Python的注释只有针对于单行的注释(用#),这是一种变通的方法)多行注释用三引号'''将注释括起来,例如:'''多行注释多行注释'''三、中文注释在文件头上写入:#coding=gbk或:#coding=utf-8虽然#这个... 阅读全文
posted @ 2014-10-20 16:00 arhatlohan 阅读(562) 评论(0) 推荐(0) 编辑