p25:  
def cheeseshop(kind,*arguments,**keywords):
       for arg in arguments:
            print arg
       keys=sorted(keywords.keys())
       for kw in keys:
           print kw,":",keywords[kw]
that *arguments must occur before **keywords.
cheeseshop("Limburger", "It’s very runny, sir.","It’s really very, VERY runny, sir.",
shopkeeper=’Michael Palin’,client="John Cleese",sketch="Cheese Shop Sketch")
2.sort usage:
pairs = [(1, ’one’), (2, ’two’), (3, ’three’), (4, ’four’)]
pairs.sort(key=lambda pair: pair[1])
p29:
list 可以作為一個隊列,數組,棧來用。支持下標索引,排序,逆序,插入,刪除,拓展等功能
當然了,list作為一個隊列來用的時候,效率并不高,因為涉及大量的元素移位操作,因此我們可以使用collections.deque
(1) filter(function,sequence)  return a sequence ..that function(item) is true
(2) map(function,sequence)     return a sequence
(3)reduce(function,sequence)  returns a single value constructed by calling the binary function function
on the first two items of the sequence, then on the result and the next item, and so on.
p35:
(1) tuple
不可更改,操作與list類似
 
(2) set
沒有重復元素,
(3) dictionaries
p36:
enumerate()  返回索引和索引值的pair 對的迭代器
for q, a in zip(questions, answers):
    print ’What is your {0}? It is {1}.’.format(q, a)
*當循環使用字典的時候,我們可以使用iteritems()函數來代替上面的enumerate()
p47:
(4) str
 轉換成字符串的函數:str()和repr()
 str.format()
 eg.  print '{0} and {1}'.format('span','eggs')
p50:
文件讀寫:
f.read()
f.readline()
f.readlines()
p52:
用json來儲存復雜結構的文件內容
json.dumps([1,'simple'.'list'])
json.dump(x,f)  //儲存x到文件f中
x=json.load(f)  //導出文件的結構數據到x
json可以處理列表和字典,對于任意類的實例,json需要做點額外的工作,這個時候我們可以下面這個包:
pickle
---------------------------------------------------------------------------------------
(5) 關于python的類,我想說明如下
    與c++類似,可以有多繼承。但是沒有所謂的虛函數機制,另外在c++中隱含的this指針在python中相對應的就是self,而且有內置的一些數據成員和函數,對于一個類__init__(self)這樣的形式的函數,我們可以看作是內置函數,可以看成是構造函數,同樣也有重載的形式,而且在對象生成時,這些函數就有了,也就是說這個是綁定于類對象的,至于隱式自動構造函數,可以從c++中得到啟發,從使用的角度來說,python更容易理解,而且也不需要手動釋放內存做析構這樣的操作,總的來說,可以從c++的類的思維習慣來看待這個python
----------------------------------------------------------------------------------------
p71:
各類包的簡單回顧:
(1) os
      os.getcwd()      //return working directory
      os.chdir()
      os.system(command)  //執行系統命令
(2) shutil
    拷貝,移動文件
    copyfile,move
(3) glob
    列出當前文件下的所有文件
    glob.glob('*.py')
p72:
(1) re
 re.findall(patern,string)
 'tea for too'.replace('roo','two')
(2) random()
  random.choice(['apple','pear','banana'])
  random.sample(xrange(100),10)
  random.random()
  random.randrange()
(3) Internet 接入
   urllib2,smtplib兩個包
(4) 日期和時間的包
     datetime
(5) 數據壓縮的包
    zlib
    t=zlib.compress(s)
    zlib.decompress(t)
(6) 計時的包
    timeit
    from timeit import Timer
    Timer(express).timeit()   //計時
(7) 質量控制的兩個包
    doctest,unittest