python中的静态方法和类方法
来源:互联网 发布:js是什么文件格式 编辑:程序博客网 时间:2024/05/17 22:10
#coding=utf-8import timeimport datetime# !/usr/bin/env python# _#_ coding:utf-8 _*_class MyClass(object): message = "hello world" def show(self): print self.message print 'name is : %s, age is :%d' % (self.name, self.age) @staticmethod def printMsg(): print "print MSG" print MyClass.message @classmethod def people(cls, name, age): print "%s peope with %s is %d years old" % (cls.__name__,name,age) return cls(name, age) def __init__(self, name = "bai", age = 12): print "constructor", name self.name = name self.age = ageMyClass.printMsg()people = MyClass.people("jack", 20)print people.nameprint people.ageprint people.message
阅读全文
0 0
- PYTHON中的静态方法和类方法
- python中的静态方法和类方法
- PYTHON中的静态方法和类方法
- python中的静态方法和类方法
- python中的静态方法和类方法
- Python中的类方法和静态方法
- python中的类方法和静态方法
- python中的类方法和静态方法
- python中的静态方法和类方法
- python中的普通方法、类方法和静态方法
- Python中的类方法和静态
- python中的静态成员方法 和 类成员方法
- python中的静态方法和类成员方法
- python中的实例方法、静态变量,静态方法、类方法、类变量和实例变量
- python中的静态方法、类方法解读
- python 中的静态方法
- Python 静态方法和静态类
- python 的静态方法和静态类
- 温故而知新--linux协议栈
- 设计模式之单例模式
- 多级联动,下拉列表取text及value值的两种方法(传统方法+JQuery方法)
- 仓库初始化
- git push首次提交报错denyCurrentBranch
- python中的静态方法和类方法
- 解决aptitude 安装软件时 package XXX is not configure yet
- oracle 基础知识查询
- Java 8 之 Stream 操作符
- 运维的那点事
- kylin 运行失败总结
- html 控制多个div不换行
- vlc 2.2.6 ubuntu下交叉编译
- NLTK04《Python自然语言处理》code03 处理原始文本