phoenix13

导航

 

2012年12月2日

摘要: 1. 循环 http://woodpecker.org.cn/abyteofpython_cn/chinese/ch06s04.html 第6章 控制流 for循环 http://www.cainiao8.com/python/basic/python_11_for.html for循环控制语句—— 阅读全文
posted @ 2012-12-02 23:04 phoenix13 阅读(119) 评论(0) 推荐(0) 编辑
 
摘要: 1.创建字典http://skyfen.iteye.com/blog/567571Python字典的应用详解方法①:>>> dict1 = {}>>> dict2 = {'name': 'earth', 'port': 80}>>> dict1, dict2({}, {'port': 80, 'na... 阅读全文
posted @ 2012-12-02 18:55 phoenix13 阅读(240) 评论(0) 推荐(1) 编辑
 
摘要: http://www.17jo.com/program/python/base/ClassUse.html Python 类的定义、继承及使用对象http://blog.csdn.net/wklken/article/details/6313265Python笔记——类定义# 例:类定义及使用class CAnimal: name = 'unname' # 成员变量 def __init__(self,voice='hello'): # 重载构造函数 self.voice = voice # 创建成员变量并赋初始值 def __de... 阅读全文
posted @ 2012-12-02 15:47 phoenix13 阅读(223) 评论(0) 推荐(0) 编辑
 
摘要: 本文http://blog.csdn.net/whycadi/article/details/2011046http://www.cnblogs.com/huxi/archive/2010/07/04/1771073.html1.Python正则式的基本用法1.1基本规则1.2重复1.2.1最小匹配与精确匹配1.3前向界定与后向界定1.4组的基本知识2.re模块的基本函数2.1使用compile加速2.2 match和search2.3 finditer2.4字符串的修改与替换3.更深入的了解re的组与对象3.1编译后的Pattern对象3.2组与Match对象3.2.1组的名字与序号3.2. 阅读全文
posted @ 2012-12-02 12:14 phoenix13 阅读(223) 评论(0) 推荐(0) 编辑
 
摘要: 1. list 去除重复http://python.u85.us/viewnews-6.htmll1 = ['b','c','d','b','c','a','a']l2 = [][l2.append(i) for i in l1 if not i in l2]print l22.中文gbk字符 正则匹配re.findall(r'<SO>[\x80-\xff]{0,10}</SO>',line)3. string int 互转str(a)int( 阅读全文
posted @ 2012-12-02 12:11 phoenix13 阅读(164) 评论(0) 推荐(0) 编辑
 
摘要: 1. show & change directory>>> import os>>> os.getcwd()'/home/user'>>> os.chdir("/tmp/")>>> os.getcwd()'/tmp'2. execute .py from shell>>>import sys>>>sys.argv = ['', 'arg1', 'arg2']>>> 阅读全文
posted @ 2012-12-02 12:10 phoenix13 阅读(151) 评论(0) 推荐(0) 编辑