文章目錄 修複不 work 的yum 錯誤提示:It's possible that the above module doesn't match the current version of Python主要是rhel 5.1 內建的python版本是2.4。yum所需要的版本是2.4於是的於是就有了下面給Python升級的過程(CentOS 5.5 中實驗成功,其他發行版本Linux可作參考)。下載wget
最近在學習Python,從《Programming Python》看到了一段有意思的內容:在Python中通過import this可以看到Python的哲學:>>> import thisThe Zen of Python, by Tim PetersBeautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better
03-網頁內容的編碼檢測鄭昀 201005 隸屬於《02.資料解析》小節我們需要確定網頁的內容/標題等文字的編碼格式,比如 utf-8 、gb2312 等。通用檢測順序一般來說,國內外類似服務的檢測順序是(參見參考資源A):charset parameter in HTTP Content-type header. <meta http-equiv="content-type"> element in the <head> of a web page for
http://davidbau.com/archives/2005/07/29/haaarg_world.htmlHaaarg, world!Continuing the "Anthony's first program" series from last time.When my six-year-old son Anthony asked me if he could program hisown computer game, I was worried that he might be
今天在我的郵件裡看到一個訪問老王python部落格的朋友給我發的一個問題,我把下面的代碼運行了下,果然不一樣。大家有興趣的話,可以運行下下面的2個例子,然後想下是為什麼,最好在下面的留言裡面給出自己的看法,多多交流總是好的。>>> a=[1,2,3]>>> for x in a:>>> if x < 2:a.insert(0,5) //這樣程式會一直跑,不會中斷了>>> a=[1,2,3]>>>
python for 語句是用來處理迴圈流程的,再配合for in操作對象,能夠合適地處理迭代的問題。 比如我們需要迴圈的輸出一個列表裡面的所有元素。 那我們可以通過:a = [1,2,3]for m in a: print m如果我們需要迭代的輸出檔案裡的每一行內容,我們可以用for m in file('1.txt','r'): print