python 来自https://pypi.python.org/pypi/skeleton/的基本Python类框架

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 来自https://pypi.python.org/pypi/skeleton/的基本Python类框架相关的知识,希望对你有一定的参考价值。

#!/usr/bin/python

class Employee:
   'Common base class for all employees'
   empCount = 0

   def __init__(self, name, salary):
      self.name = name
      self.salary = salary
      Employee.empCount += 1
   
   def displayCount(self):
     print "Total Employee %d" % Employee.empCount

   def displayEmployee(self):
      print "Name : ", self.name,  ", Salary: ", self.salary

"This would create first object of Employee class"
emp1 = Employee("Zara", 2000)
"This would create second object of Employee class"
emp2 = Employee("Manni", 5000)
emp1.displayEmployee()
emp2.displayEmployee()
print "Total Employee %d" % Employee.empCount
#!/usr/bin/env python
"""
Basic script to create an empty python package containing one module
"""
from skeleton import Skeleton, Var


class BasicModule(Skeleton):
    """
    Create an empty module with its etup script and a README file.
    """
    src = 'basic-module'
    variables = [
        Var('module_name'),
        Var('author'),
        Var('author_email'),
        ]


def main():
    """Basic command line bootstrap for the BasicModule Skeleton"""
    BasicModule.cmd()

if __name__ == '__main__':
    main()

以上是关于python 来自https://pypi.python.org/pypi/skeleton/的基本Python类框架的主要内容,如果未能解决你的问题,请参考以下文章

Python自动化 第十一篇:Python进阶-RabbitMQ队列/Memcached/Redis

python 来自Python的通知

python 来自Python的Git pull

python 来自Python的os文件系统

一封来自“Python”的信

来自 Black Hat Python 书的 Python 嗅探