# -*- coding:utf-8 -*-
# !/usr/bin/python
class Dog():
""""一次模拟小狗的简单尝试"""
def __init__(self,name,age):
"""初始化属性name和age"""
print self
print type(self)
print dir(self)
self.name = name
self.age = age
def sit(self):
"""模拟小狗被命令时蹲下"""
print self.name.title() + "is now sitting."
def roll_over(self):
"""模拟小狗被命令时打滚"""
print (self.name.title() + "rolled over!")
a=Dog('aaaa','bbbb')
C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled2/object/dog.py
<__main__.Dog instance at 0x020F2BC0>
<type 'instance'>
['__doc__', '__init__', '__module__', 'roll_over', 'sit']
Process finished with exit code 0