摘要:
from apscheduler.schedulers.blocking import BlockingScheduler from datetime import datetime def test_tick(): print(f'time is {datetime.now()}') if __n 阅读全文
摘要:
python中的逻辑操作符and 和or,也叫惰性求值,由于是惰性,只要确定了值就不往后解析代码了。 and 两种用法: 表达式 exp1 and exp2:用法同java 的 && 字面量值 >>> a = '' and [] and None >>> a '' >>> a = 2 and '' 阅读全文
摘要:
- with 语句的目的是简化try/finally ,即便由于异常,return,sys.exit()调用而终止,也会执行指定的操作 - 上下文管理器协议包含__enter__和__exit__ 两个方法 - with 语句开始执行时会在上下文管理器对象上调用__enter__方法 - with 阅读全文