下面是Python資料處理的題目說明與要求: The attachment is a log file used to show running status of set-top-box, and each line in the file follows the format of “LineNumber + Time + ProcessName + (ProcessID) + Logs”, currently the logs are displayed in time order.
一、標準輸入輸出 1、列印到螢幕 產生輸出的最簡單方法是使用print語句,可以通過用逗號分隔零個或多個運算式。這個函數傳遞運算式轉換為一個字串,如下結果寫到標準輸出 - print ("Python is really a great language,", "isn't it?") 這將產生以下結果標準螢幕上 : Python is really a great language, isn't it? 2、讀取鍵盤輸入
下載Skydrive上的檔案夾的話,所有檔案會打包成一個zip壓縮包。不過解壓這個壓縮包以後,發現所有中文名稱的檔案都被重新命名成了類似File1.txt這樣的格式,同時會多出來一個檔案,名為“Encoding Error.txt”。這個檔案說明了下載的檔案被重新命名是Skydrive伺服器為之,檔案前三行是:Due to the limitations of the supported zip file format, the following file(s) had to be
現在因為已經安裝了2.6的Python,以及支援2.6的Eric4,就不想再重新安裝2.5來繼續配置Apache下mod_python了。後來發現了一篇文章Running Python as CGI in Apache in Windows ,講述以CGI模式代替mod_python來運行python script。還有這篇Python for Windows 。做法是:開啟httpd.conf,找到”#ScriptInterpreterSource Registry “,移除前面的注釋#
做個小總結:可能是我還沒找到更好的方法,但是小遺憾的是,python似乎目前無法支援類似shell指令碼,perl所支援的標量插入,所以在顯示的時候無法像下面,這種個人感覺,最清晰,方便的方法。比如,使用者輸人2個變數‘basketball', 'swimming', shell或者per可以如下顯示出 I love basketball and swimming the best.#shellinput = 'basketball'input2 = 'swimming'print 'I