跟網上其他的程式是一樣的,這裡分別增加了一個全域替換的函數。可以進行整個文檔的替換,這樣可以實現翻譯,查錯等全域替換的操作。# -*- coding: utf-8 -*-import os,types,picklefrom win32com.client import Dispatchimport win32com.clientclass Excel: """A utility to make it easier to get at Excel.""" def
cocos2d is a framework for building 2D games, demos, and other graphical/interactive applications.cocos2d simplifies the game development in these areas:Flow control: Manage the flow control between different scenes in an easy waySprites: Fast and
Python對於Email的分成兩個部分:對於POP、SMTP的支援。對於Email資料的支援。第一部分: 用POP、SMTP來讀取信件:import getpass, poplibM = poplib.POP3('localhost')M.user(getpass.getuser())M.pass_(getpass.getpass())numMessages = len(M.list()[1])for i in range(numMessages): for j in M.retr(i+
函數:getpass.getuser() 解釋: Return the “login name” of the user. Availability: Unix, Windows. This function checks the environment variables LOGNAME, USER, LNAME and USERNAME, in order, and returns the value of the first one which is set to a non-
python linux調試 python是動態語言,編譯器檢查不到運行時的文法問題,而這些低級問題常常造成調試效率很低。之前在linux伺服器上調試,都是通過print和異常報錯來排查,簡直弱爆了。python內建的pdb正是調試的利器。我們先建立一個測試指令碼:Shell代碼 touch debug.py 內容:Shell代碼 print "hello" i = 0 for j in range(10): i += j print i 常用命令說明:l
1、NameError:嘗試訪問一個未申明的變數>>> vNameError: name 'v' is not defined2、ZeroDivisionError:除數為0 >>> v = 1/0ZeroDivisionError: int division or modulo by zero3、SyntaxError:語法錯誤 >>> int intSyntaxError: invalid syntax