孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

class book:
    _author=''
    _name=''
    _page=0
    price=0
    _press=''
    def _check(self,item):
        if item=='':
            return 0
        else:
            return 1

    def show(self):
        if self._check(self._author):
            print(self._author)
        else:
            print('No value')
        if self._check(self._name):
            print(self._name)
        else:
            print('No value')

    def setname(self,name):
        self._name=name
    def __init__(self,author,name):
        self._author=author
        self._name=name
       
a=book('Tom','A Wonderful Book')
a.show()

posted on 2011-04-25 22:19  孤独的猫  阅读(5395)  评论(0编辑  收藏  举报