
Python
yuanzhou1990
这个作者很懒,什么都没留下…
展开
-
python socket编程
一、套接字套接字是为特定网络协议(例如TCP/IP,ICMP/IP,UDP/IP等)套件对上的网络应用程序提供者提供当前可移植标准的对象。它们允许程序接受并进行连接,如发送和接受数据。为了建立通信通道,网络通信的每个端点拥有一个套接字对象极为重要。套接字为BSD UNIX系统核心的一部分,而且他们也被许多其他类似UNIX的操作系统包括Linux所采纳。许多非BSD UNIX系统(如转载 2014-07-21 10:26:09 · 264 阅读 · 0 评论 -
python texttable表格输出
from texttable import Texttabletable = Texttable()table.set_deco(Texttable.BORDER)table.set_cols_align(["l", "l", "l"])#require three columnstable.set_cols_valign(["m", "m", "m"])#table原创 2014-10-20 15:36:50 · 9459 阅读 · 2 评论 -
隐藏输入密码
1.使用raw_input函数:raw_input原创 2014-10-20 10:36:49 · 527 阅读 · 0 评论 -
python中的函数:filter/map/reduce/lambda
filter(...) filter(function or None, sequence) -> list, tuple, or string Return those items of sequence for which function(item) is true. If function is None, return the items th原创 2014-10-15 09:54:58 · 397 阅读 · 0 评论 -
python thread
python thread doc : http://www.python.org/doc/2.5.2/lib/module-threading.html。another good blog : from http://www.cnblogs.com/tqsummer/archive/2011/01/25/1944771.html:一、Python中的线程使用: Python转载 2014-10-14 13:24:05 · 342 阅读 · 0 评论 -
使用set集合出来list列表的计算
比较2个列表是否相等:1.寻原创 2014-10-14 13:41:05 · 412 阅读 · 0 评论 -
python中的函数:zip ,map,enumerate
map( function,sequence,[sequence....] )---> list原创 2014-10-14 13:13:06 · 370 阅读 · 0 评论 -
python for循环迭代序列
1.迭代字符串for ch in "Name":原创 2014-07-15 12:59:28 · 1286 阅读 · 0 评论 -
python 字符串编码与解码
1. 字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。 decode的作用是将其他编码的字符串转换成unicode编码,如str1.decode('gb2312'),表示将gb2312编码的字符串str1转换成unico原创 2014-07-11 13:19:13 · 517 阅读 · 0 评论 -
python 浅拷贝与深拷贝
import copyll = [1,2,3,["","]]原创 2014-07-11 18:51:06 · 323 阅读 · 0 评论 -
python 使用切片,每次输出都把 位于最后的一个字符砍掉
str = "abcde"for i in range(-1,-len)原创 2014-07-10 15:36:17 · 3352 阅读 · 0 评论 -
Python安装XlsxWriter库
XlsxWriter库:处理Excel XLSX files有关的Python库。地址:http://xlsxwriter.readthedocs.org/源码安装:$ git clone https://github.com/jmcnamara/XlsxWriter.git$ cd XlsxWriter$ sudo python setup.py install原创 2014-07-03 12:15:41 · 10503 阅读 · 0 评论 -
Python 标准库 urllib2
Python 标准库中有很多实用的工具类,但是在具体使用时,标准库文档上对使用细节描述的并不清楚,比如 urllib2 这个 HTTP 客户端库。这里总结了一些 urllib2 库的使用细节。 1 Proxy 的设置2 Timeout 设置3 在 HTTP Request 中加入特定的 Header4 Redirect5 Cookie转载 2014-07-22 22:26:52 · 581 阅读 · 0 评论 -
Python模块学习 --- urllib
urllib模块提供的上层接口,使我们可以像读取本地文件一样读取www和ftp上的数据。每当使用这个模块的时候,老是会想起公司产品的客户端,同事用C++下载Web上的图片,那种“痛苦”的表情。我以前翻译过libcurl教程,这是在C/C++环境下比较方便实用的网络操作库,相比起 libcurl,Python的urllib模块的使用门槛则低多了。可能有些人又会用效率来批评Python,其实在操作网络转载 2014-07-22 22:01:43 · 256 阅读 · 0 评论 -
Python:使用threading模块实现多线程编程
Python:使用threading模块实现多线程编程一[综述]Python这门解释性语言也有专门的线程模型,Python虚拟机使用GIL(Global Interpreter Lock,全局解释器锁)来互斥线程对共享资源的访问,但暂时无法利用多处理器的优势。在Python中我们主要是通过thread和 threading这两个模块来实现的,其中Python的threading模块是对th转载 2014-07-21 18:16:26 · 450 阅读 · 0 评论 -
python 类变量
class Foo(object):x = 1.5原创 2014-07-19 21:19:46 · 301 阅读 · 0 评论 -
python prettytable
将内容如表格方式整齐输出转载 2014-10-20 15:26:13 · 683 阅读 · 0 评论