python module的结构

时间:2022-06-27 02:30:38

python有很多module,下面是module的结构图:

python module的结构

拿httplib做例子,httlip module有:

4个class( HTTPConnection,HTTPSConnection,HTTPResponse,HTTPMessage ),

12个exception( HTTPException,NotConnected,InvalidURL,UnknownProtocol,UnknownTransferEncoding,UnimplementedFileMode,IncompleteRead,ImproperConnectionState,CannotSendRequest,CannotSendHeader,ResponseNotReady,BadStatusLine 

3个constant( HTTP_PORT,HTTPS_PORT,responses 

class会包含method和attribute(不一定有)

拿HTTPResponse做例子,HTTPResponse有:

4个method( read(),getheader(name[,default]),getheaders(),fileno() )

4个constant( msg,version,status,reason )