摘要:        
原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples在字典中循环时,关键字和对应的值可以使用iteritems()方法同时解读出来。knights = {'gallahad': 'the pure...    阅读全文
posted @ 2015-03-05 15:53
职场人的思考
阅读(650)
评论(0)
推荐(0)
        
            
        
        
摘要:        
原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples理解字典的最佳方式是把它看做无序的键:值对(key:value 对)集合,键必须是互不相同的(在同一个字典之内)。一对大括号创建一个空的字典:{...    阅读全文
posted @ 2015-03-05 15:25
职场人的思考
阅读(234)
评论(0)
推荐(0)
        
            
        
        
摘要:        
原文地址:http://docs.pythontab.com/python/python3.4/datastructures.html#tut-tuples集合是一个无序不重复元素的集。基本功能包括关系测试和消除重复元素。集合对象还支持 union(联合),intersection(交),diffe...    阅读全文
posted @ 2015-03-05 15:18
职场人的思考
阅读(289)
评论(0)
推荐(0)
        
            
        
        
摘要:        
tuple0=() #空tuple1="wo", #元组中包括单个元素用,tuple2="monkey","cat","chickey" #可以不用()tuple3=("monkey","cat","chickey")    阅读全文
posted @ 2015-03-05 15:11
职场人的思考
阅读(177)
评论(0)
推荐(0)
        
            
        
        
摘要:        
列表常用方法汇总:#定义列表lili=[12.23,456,88,9]a=[1,2,3]#添加元素到列表结尾li.append(360)#追加列表元素extend(L)li.extend(a)#在指定位置插入一个元素insert(i,x)li.insert(0, 888)#删除列表中值为9的元素li...    阅读全文
posted @ 2015-03-05 14:31
职场人的思考
阅读(213)
评论(0)
推荐(0)
        
            
        
        
摘要:        
原文地址:http://docs.pythontab.com/python/python3.4/controlflow.html#tut-functions一个最不常用的选择是可以让函数调用可变个数的参数。这些参数被包装进一个元组(参见元组和序列)。在这些可变个数的参数之前,可以有零到多个普通的参数...    阅读全文
posted @ 2015-03-05 14:00
职场人的思考
阅读(283)
评论(0)
推荐(0)
        
            
        
        
摘要:        
原文地址:http://docs.pythontab.com/python/python3.4/controlflow.html#tut-functions函数可以通过关键字参数的形式来调用,形如keyword=value。例如,以下的函数:def parrot(voltage, state='a ...    阅读全文
posted @ 2015-03-05 13:28
职场人的思考
阅读(2947)
评论(0)
推荐(0)
        
            
        
        
摘要:        
def fib(n): a,b=0,1 while a<n: print(a,end=" ") a,b=b,a+b print() fib(2000) 输出:0 1 1 2 3 5 8 13 21 34 55 89 144 233...    阅读全文
posted @ 2015-03-05 11:35
职场人的思考
阅读(269)
评论(0)
推荐(0)
        
                    
                
浙公网安备 33010602011771号