标签:字符串 style nat point func fun www span 参数
hasattr() 函数用于判断对象是否包含对应的属性。(has attribute)
hasattr(object, name)
class Coordinate: x = 10 y = -5 z = 0 point1 = Coordinate() print(hasattr(point1, ‘x‘)) print(hasattr(point1, ‘y‘)) print(hasattr(point1, ‘z‘)) print(hasattr(point1, ‘no‘)) # 没有该属性
http://www.runoob.com/python/python-func-hasattr.html
标签:字符串 style nat point func fun www span 参数
原文地址:https://www.cnblogs.com/lucky466/p/10250794.html