- 博客(6)
- 收藏
- 关注
原创 #python#用python试了下递归
erlang只能递归,所以先用python练练手: def cut(a): try: out = a.pop() print out cut(a) except Exception,e: print 'this list is empty' 如果不用异常,会弹出一堆恶心的错误。所以。。。
2014-08-11 17:52:56
321
原创 #erlang#学习笔记
一.erlang的模式匹配问题:Lhs=Rhs Lhs指模式,可以是[X,Y]、{X,Y}或X之类的列表,元组和变量,Rhs为值(不用怎么解释了吧)。在erlang中,若想得到python中"...[...]"列表引索的效果,需要写一个和值相适应的模式,并且在模式中把想求的值使用一个变量代替(和py中的形式参数类似),再匹配值: 例如: 1.现在捆绑一个变量:X = {232,34,"hel
2014-08-11 17:49:09
516
原创 #python#面向对象练手+模仿Amazon的物流追踪显示
等书等到无聊,写了这么一点: 查询类: class Trace(): def Lookup(self): #查询其子类设置的内容 self.HeadFormat = "%-*s%*s" self.Bwidth = len(self.Booktime);self.Awidth = len(self.Arrivetime) s
2014-08-11 17:47:45
535
原创 #python#异常处理练手
代码如下: __author__ = 'Administrator' try: while True: x = input("Enter the first number:") y = input("Enter the second number:") print x/y except ZeroDivisionError: prin
2014-08-11 17:45:28
433
原创 #python#自己写的一段小代码
代码: __author__ = 'Administrator' DEFAULT_TENANT_ID = 1234 DEFAULT_ROLE_ID = 1234 TENANT_ID = int(input("Please enter the tenant ID:")) ROLE_ID = int(input("Please input your Role ID:")) STATUS = {'E'
2014-08-11 17:45:03
433
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人