Python技术实现细节说明文档

一、判断对象类型

not isinstance(self.max_length, int) or 
isinstance(self.max_length, bool) or
self.max_length <= 0)

二、判断对象是否为空
if self.max_length is None:
return []

三、判断字符串以某某开始 或者 判断字符串以某某结束
if attr.startswith("helper_") and attr != "helper_class":
if attr.endswith("helper_")   and attr != "helper_class":


四、.join()函数-- 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。如下面以空去连接字符串
lambda函数亦叫匿名函数,lambda x 可以想成 def(x)
filter(lambda x:x.startwidth)函数--filter()函数用于过滤序列,过滤掉不符合条件的元素,返回符合条件的元素组成新列表。
    x.startwith()函数--
例如: ' '.join(sorted(filter(lambda x: x.startswith(curr), subcommands)))




原文地址:https://www.cnblogs.com/zhulimin/p/14345011.html