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 可以作為一個(gè)隊(duì)列,數(shù)組,棧來用。支持下標(biāo)索引,排序,逆序,插入,刪除,拓展等功能
當(dāng)然了,list作為一個(gè)隊(duì)列來用的時(shí)候,效率并不高,因?yàn)樯婕按罅康脑匾莆徊僮鳎虼宋覀兛梢允褂胏ollections.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
沒有重復(fù)元素,
(3) dictionaries
p36:
enumerate()  返回索引和索引值的pair 對(duì)的迭代器
for q, a in zip(questions, answers):
    print ’What is your {0}? It is {1}.’.format(q, a)
*當(dāng)循環(huán)使用字典的時(shí)候,我們可以使用iteritems()函數(shù)來代替上面的enumerate()
p47:
(4) str
 轉(zhuǎn)換成字符串的函數(shù):str()和repr()
 str.format()
 eg.  print '{0} and {1}'.format('span','eggs')
p50:
文件讀寫:
f.read()
f.readline()
f.readlines()
p52:
用json來儲(chǔ)存復(fù)雜結(jié)構(gòu)的文件內(nèi)容
json.dumps([1,'simple'.'list'])
json.dump(x,f)  //儲(chǔ)存x到文件f中
x=json.load(f)  //導(dǎo)出文件的結(jié)構(gòu)數(shù)據(jù)到x
json可以處理列表和字典,對(duì)于任意類的實(shí)例,json需要做點(diǎn)額外的工作,這個(gè)時(shí)候我們可以下面這個(gè)包:
pickle
---------------------------------------------------------------------------------------
(5) 關(guān)于python的類,我想說明如下
    與c++類似,可以有多繼承。但是沒有所謂的虛函數(shù)機(jī)制,另外在c++中隱含的this指針在python中相對(duì)應(yīng)的就是self,而且有內(nèi)置的一些數(shù)據(jù)成員和函數(shù),對(duì)于一個(gè)類__init__(self)這樣的形式的函數(shù),我們可以看作是內(nèi)置函數(shù),可以看成是構(gòu)造函數(shù),同樣也有重載的形式,而且在對(duì)象生成時(shí),這些函數(shù)就有了,也就是說這個(gè)是綁定于類對(duì)象的,至于隱式自動(dòng)構(gòu)造函數(shù),可以從c++中得到啟發(fā),從使用的角度來說,python更容易理解,而且也不需要手動(dòng)釋放內(nèi)存做析構(gòu)這樣的操作,總的來說,可以從c++的類的思維習(xí)慣來看待這個(gè)python
----------------------------------------------------------------------------------------
p71:
各類包的簡(jiǎn)單回顧:
(1) os
      os.getcwd()      //return working directory
      os.chdir()
      os.system(command)  //執(zhí)行系統(tǒng)命令
(2) shutil
    拷貝,移動(dòng)文件
    copyfile,move
(3) glob
    列出當(dāng)前文件下的所有文件
    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兩個(gè)包
(4) 日期和時(shí)間的包
     datetime
(5) 數(shù)據(jù)壓縮的包
    zlib
    t=zlib.compress(s)
    zlib.decompress(t)
(6) 計(jì)時(shí)的包
    timeit
    from timeit import Timer
    Timer(express).timeit()   //計(jì)時(shí)
(7) 質(zhì)量控制的兩個(gè)包
    doctest,unittest