python
文章平均质量分 64
skyin333
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
python 内建函数basestring笔记
示例: def isAString(obj): return isinstance(obj, basestring) # isinstance(obj, (str, unicode)). print isAString('abc') # True print isAString(u'您好') # True print isAString(list()) #原创 2013-03-07 22:49:53 · 4072 阅读 · 0 评论 -
python 内建函数map笔记
示例: def func(item): pass results = map(func,iterable) map实现代码: def map(func, seq): mapped_seq = [] for eachItem in seq: mapped_seq.append(func(eachItem)) ret原创 2013-03-07 22:00:24 · 704 阅读 · 0 评论 -
python之string.maketrans和str.translate
示例: import string s = 'abcd--dcba' # 参数from和to的长度必须一致 table = string.maketrans('', '') # type(table) is 'str' print(s.translate(table)) # 输出 abcd--dcba table = string.maketrans('ab',原创 2013-03-11 22:01:22 · 6493 阅读 · 1 评论 -
python之enumerate
示例: test.txt内容: aaaa bbbb cccc file_object = open(r'c:\test.txt') try: for line_num, context in enumerate(file_object): print str(line_num) + ':' + context finally: file_object.clos原创 2013-03-13 21:37:07 · 892 阅读 · 0 评论 -
The Zen of Python
The Zen of Python, by Tim Peters Beautiful is better than ugly. 美胜丑 Explicit is better than implicit. 明胜暗 Simple is better than complex. 简胜复 Complex is better than complicated. 复胜杂 Flat is转载 2013-04-04 16:51:03 · 637 阅读 · 0 评论
分享