Print line containing “word” python

后端 未结 2 1016
礼貌的吻别
礼貌的吻别 2021-01-19 06:17

I would like to print ONLY the line which contains \"Server\" in the below piece of output:

Date: Sun, 16 Dec 2012 20:07:44 GMT
Expires: -1
Cache-Control: pr         


        
2条回答
  •  借酒劲吻你
    2021-01-19 06:58

    for single_line in websiteheaders.splitlines():
        if `Server` in single_line:
            print single_line
    

提交回复
热议问题