python 查看趴下来的数据

#coding=utf-8
import re
from lxml import etree
import requests

def requests_view(response):
    import webbrowser
    requests_url = response.url
    base_url = '<head><base href="%s">' %(requests_url)
    base_url = base_url.encode('utf-8')
    content = response.content.replace(b"<head>",base_url)
    tem_html = open('tmp.html','wb')
    tem_html.write(content)
    tem_html.close()
    print(tem_html)
    webbrowser.open_new_tab("tmp.html")

response = requests.get("http://www.spbeen.com/tool/request_info/")
requests_view(response)

  

posted @ 2018-04-23 15:36  brady-wang  阅读(312)  评论(0编辑  收藏  举报