# -*- coding:utf-8 -*-
#python 3.6
import requests
from bs4 import BeautifulSoup
import urllib.request
import re
import json
#如果是网址,可以用这个办法来读取网页
html_doc = "http://www.360che.com"
req = urllib.request.Request(html_doc)
webpage = urllib.request.urlopen(req)
html = webpage.read()
soup = BeautifulSoup(html, 'html.parser') #文档对象
a = []
# 类名为xxx而且文本内容为hahaha的div
for k in soup.find_all('div',class_='ad-div horizontal'):#,string='更多'
# print(k)
a.append(k)
#<div class="atcTit_more"><span class="SG_more"><a href="http://blog.sina.com.cn/" target="_blank">更多>></a></span></div>
pattern = re.compile(r'\d+')
# result1 = pattern.findall(str(a[0]))
# print(result1)
r=requests.get('https://ggxt-api.kcimg.cn/api/show?id=57032401®ionId=110100&productId=undefined&truckLevel=')
print ('HTTP状态码:',r.status_code)
print ('响应内容:',r.text)