2011年8月25日

Python——Utilities工具

摘要: 以下是学习goole PYTHON教程过程中的一些笔记。'#' 后面的是输出,希望你能从中获取你想要的。Closing Thoughtsa = ['aaaa', 'bb', 'cccc']a#['aaaa', 'bb', 'cccc']result = [][ len(s) for s in a ]#[4,2,5]a = [1, 2, 3, 4]a#[1, 2, 3, 4][ num*num for num in a if num > 2]#[9, 16]import osos 阅读全文

posted @ 2011-08-25 22:05 FengMichael 阅读(2592) 评论(0) 推荐(0)

Python——RegularExpressions正则表达式

摘要: 以下是学习goole PYTHON教程过程中的一些笔记。'#' 后面的是输出,希望你能从中获取你想要的。Regular Expressionsimport rematch = re.search(pat, text) #match objectmatch = re.search('iig', 'called piiig')#<_sre,SRE_Match object at 0xf7f7c448>match.group()#'iig'match = re.search('igs', 'calle 阅读全文

posted @ 2011-08-25 22:01 FengMichael 阅读(201) 评论(0) 推荐(0)

Python——Dict类型

摘要: 以下是学习goole PYTHON教程过程中的一些笔记。'#' 后面的是输出,希望你能从中获取你想要的。Dictd = {}d['a'] = 'alpha'd['g'] = 'gamma'd['o'] = 'omega'd['a'] #'alpha'd['x'] #errord.get('x') #d.get('a') #'alpha''a' in d #True' 阅读全文

posted @ 2011-08-25 21:59 FengMichael 阅读(119) 评论(0) 推荐(0)

导航