摘要:
使用sqlchemy查询出一个集合的时候第一个对象可以使用,后面的就报如下错误。 sqlalchemy.orm.exc.DetachedInstanceError: Instance <LoginInfo at 0x6d79e70> is not bound to a Session; attrib 阅读全文
摘要:
在看 Bottle 代码中看见 functools.wraps 这种用法。 def make_default_app_wrapper(name): """ Return a callable that relays calls to the current default app. """ a = 阅读全文
摘要:
if 后面跟的是条件表达式,条件表达式的结果为True或者False。 (1)如果if后面的条件是数字,只要这个数字不是0,python都会把它当做True处理,见下面的例子: if 3: print 'OK' 输出OK,但是如果数字是0,就会被认为是False。 (2)如果if后面跟的是字符串,则只要这个字符串不为空串,python就把它看作True,参见下例 if 'hehe':... 阅读全文