摘要: 异常模板 常用的异常种类 主动触发异常 断言 阅读全文
posted @ 2018-01-02 17:20 ︻◣_蝸犇り~ 阅读(187) 评论(0) 推荐(0)
摘要: 语法 str.replace(old, new[, max]) 参数 old -- 将被替换的子字符串。 new -- 新字符串,用于替换old子字符串。 max -- 可选字符串, 替换不超过 max 次 re.sub(pattern, repl, string, count=0, flags=0 阅读全文
posted @ 2018-01-02 16:52 ︻◣_蝸犇り~ 阅读(57026) 评论(0) 推荐(1)
摘要: 静态方法@staticmethod:不可访问类中的变量与方法,唯一的关联就是通过类名去调用 类方法@classmethod:只能访问类变量,不能访问实例变量 属性方法@property:把类里面的方法变成属性,其跟普通类没有关系 属性方法例子 1 class Flight(object): 2 de 阅读全文
posted @ 2018-01-02 16:16 ︻◣_蝸犇り~ 阅读(208) 评论(0) 推荐(0)