2011-04-21 55 views

回答

13

屬性self.headers是一個類似於字典的結構,所以你可以這樣做:

def do_GET(self): 
    host = self.headers.get('Host') 

當標頭不存在,則返回None

+0

Here http://docs.python.org/library/rfc822.html#rfc822.Message – skrat 2011-04-21 13:46:38