文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>python stack

python stack

时间:2007-12-26  来源:linuxGentoo

#!/usr/bin/env python
# add stack datastructure
#

__author__ = "lynn lin"

class UnderFlowError(Exception):
    pass
class stack(object):
    def __init__(self):
        self.sta = []
    def __len__(self):
        return len(self.sta)
    def StackEmpty(self):
        return self.__len__()
    def push(self,value):
        self.sta.append(value)
    def pop(self):
        try:
            return self.sta.pop()
        except:
            raise UnderFlowError,"stack is empty ,no value to pop!"

相关阅读 更多 +
排行榜 更多 +
我的武侠梦手游下载

我的武侠梦手游下载

角色扮演 下载
快乐连连看下载免费版

快乐连连看下载免费版

休闲益智 下载
泛滥死者布道手机版下载

泛滥死者布道手机版下载

角色扮演 下载