标签:att cookies 16px 获取 font main span attr cookie
(1)setup
(2)设全局变量 global
(3)反射
以登录的cookie多次使用为例:
1.登录中加:if res.cookies: setattr(GetData,‘Cookie‘,re)
2.充值中使用:getattr(GetData,‘Cookie‘)
class GetData: cookies = ‘小刘‘ if __name__ == ‘__main__‘: print(GetData.cookies) setattr(GetData,‘cookies‘,‘小花‘) # 修改类属性cookies值 print(hasattr(GetData,‘cookies‘)) # 判断是否有类属性cookies,有为True print(GetData.cookies) print(getattr(GetData,‘cookies‘)) # attribute,获取类属性值 delattr(GetData,‘cookies‘) # 删除类属性cookies print(hasattr(GetData,‘cookies‘))
标签:att cookies 16px 获取 font main span attr cookie
原文地址:https://www.cnblogs.com/kite123/p/12092352.html