摘要:
自定义keyfile: 路径必须位于/etc/NetworkManager/system-connections/*.nmconnection This file must be owned by root and be readably only by root - otherwise Netwo 阅读全文
摘要:
类思想实现 class Fabonacci: def __init__(self): self.b=[1,1] # 缓存计算结果 def __call__(self,p): if p <= len(self.b): # 判断是否已经计算过 return self.b[p-1] for v in ra 阅读全文
摘要:
__bool__ 内建函数bool(),或者对象放在逻辑表达式的位置,调用这个函数返回布尔值,没有定义__bool__(),就找__len__()返回长度,非0为真,如果__len__()也没有定义,所有实例都返回真 class B:pass print(bool(B())) class C: de 阅读全文
摘要:
p='''bottle\r\nbag\r\nbig\napple''' import re regex=re.compile(r'\bb(?P<middle>\w)(?P<tail>g)') mat=regex.finditer(p) print(mat) for m in mat: print(m 阅读全文