Python built-in tools
Built-in functions
str(string) 返回对象的字符串表示 list(seq) tuple(seq) int(x) 把字符串或数字转换为整数 long(x) float(x) Complex(real, image) hex(i) oct(i) ord(c) 返回单个字符的ascii值 chr(i) 返回ascii值为i的字符 min(i[, i]*) max(i[, i]*)
Attribute operation functions
The four built-in functions perform the following operations on the attributes in a namespace: whether they exist, get values, set values, and delete . Available for modules, classes and instances.
hasattr 有属性则返回1,否则0 getattr setattr delattr
Execution program
import exec code [in globaldict[, localdict]] compile(string, filename, kind) execfile(filename[, globaldict[, localdict]]) eval(code[, globaldict[, localdict]])
Library module
Basic string operation: str module
Advanced string operation: re module (regular expression)
General operating system interface: os module
Copy files and directories: shutil module
Internat related modules:
公共网关接口:cgi模块 操作URL: urllib和urlparse模块 特殊的internet协议:httplib, ftplib, gopherlib, poplib, imaplib, nntplib, smtplib 处理internat文件的模块:sgmllib, htmllib, xmllib, formatter, rfc822, mimetools, binhex, uu, binascii, xdrllib, mimetypes, base64, quopri, mailbox, mimify