Python中如何只獲取響應頭數(shù)據(jù)中的location值(就是重定向后的url),而無需獲取響應體,以便提高執(zhí)行效率?urllib2.urlopen("http://www.baidu.com/link?url=cvmhrH2smgwBRrY4tngUZoaIRvg4Qjb0izqkvsh-FuCfuU97ljPjAiFokLX8-WFmOSd7hVU7_hxjABHT4ziQnnHRVyms8EYq05eDT4bDgULjZEH2ibm_QT_tWNIoLXYu").geturl()雖然可以使用urllib2中的geturl方法,但貌似在使用urlopen的時候,會順便獲取響應體吧?
Python:如何只獲取響應頭中的location值
胡說叔叔
2019-04-13 08:46:06