亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Manuel d'apprentissage Python / Python內置工具

Python內置工具

內置函數

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]*)

屬性操作函數

四個內置函數分別對一個名字空間里的屬性做如下操作:是否存在,取值,設值,刪除??捎糜谀K,類和實例。

hasattr                       有屬性則返回1,否則0

getattr

setattr

delattr

執(zhí)行程序

import

exec code [in globaldict[, localdict]]

compile(string, filename, kind)

execfile(filename[, globaldict[, localdict]])

eval(code[, globaldict[, localdict]])

庫模塊

基本字符串操作:str模塊

高級的字符串操作:re模塊(正則表達式)

通用的操作系統(tǒng)接口:os模塊

拷貝文件和目錄:shutil模塊

Internat相關模塊:

公共網關接口:cgi模塊

操作URL: urllib和urlparse模塊

特殊的internet協(xié)議:httplib, ftplib, gopherlib, poplib, imaplib, nntplib, smtplib

處理internat文件的模塊:sgmllib, htmllib, xmllib, formatter, rfc822, mimetools, binhex, uu, binascii, xdrllib, mimetypes, base64, quopri, mailbox, mimify

處理二進制數據:struct模塊

調試,時間和優(yōu)化:pdb, time, profile

拷貝:copy模塊

隨機:random模塊