02 2017 档案

摘要:import anydbm as dbm import cPickle as pickle class BottleBucket(object): '''Memory-caching wrapper around anydbm''' def __init__(self, name): self.__dict__['name'] = name se... 阅读全文
posted @ 2017-02-23 16:17 鸪斑兔 阅读(166) 评论(0) 推荐(0) 编辑
摘要:line是模板中一行的内容,类似: {{x}}testinfo{{x+10}} x=10时,模板输出: 10testinfo20 阅读全文
posted @ 2017-02-22 20:28 鸪斑兔 阅读(432) 评论(0) 推荐(0) 编辑
摘要:>>> hobbies = ['software'] >>> ('notchecked', 'checked')['software' in hobbies] 'checked' >>> 'checked' if 'software' in hobbies else 'notchecked' 'checked' >>> hobbies = ['xxx'] >& 阅读全文
posted @ 2017-02-10 16:36 鸪斑兔 阅读(144) 评论(0) 推荐(0) 编辑
摘要:一个带有参数的装饰器的例子: bottle.py中自动转换参数类型的装饰器: 阅读全文
posted @ 2017-02-06 10:24 鸪斑兔 阅读(1806) 评论(0) 推荐(0) 编辑
摘要:import re class SimpleTemplate(object): re_block = re.compile(r'^\s*%\s*((if|elif|else|try|except|finally|for|while|with).*:)\s*$') re_end = re.compile(r'^\s*%\s*end(.*?)\s*$') re_cod... 阅读全文
posted @ 2017-02-04 10:35 鸪斑兔 阅读(242) 评论(0) 推荐(0) 编辑