fail to grep the "Server:" string line in headers
printf
printf at hongkong.com
Wed Nov 21 18:37:16 EST 2001
More information about the Python-list mailing list
Wed Nov 21 18:37:16 EST 2001
- Previous message (by thread): which one to choose - NumPy or Scientific Python
- Next message (by thread): fail to grep the "Server:" string line in headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Help
I would like to grep the string after "Server:" in the headers. Any
one can help me?
I think I need get the string of headers, then put to search in
"re", and grep the ...
And is there any way to "grep" words in python?
class collectInfo:
def __init__(self, _host):
self.host = _host
def getServerName(self):
h = httplib.HTTP(self.host)
h.putrequest('GET', '/')
h.putheader('Accept', 'text/html')
h.putheader('Accept', 'text/plain')
h.endheaders()
errcode, errmsg, headers = h.getreply()
print headers
p=re.compile('Server:') #wrong, why?
print p.search(hearders).span()#wrong
why?
- Previous message (by thread): which one to choose - NumPy or Scientific Python
- Next message (by thread): fail to grep the "Server:" string line in headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list