|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我的程序为:
import requests
import numpy
import json
from lxml import etree
import pandas as pd
url = 'https://odds.500.com/fenxi/ouzhi-831423.shtml'
header = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
}
def find():
url = 'http://odds.500.com/fenxi1/json/ouzhi.php'
global cid
#cid = 1
def xy():
global cid
print(cid)
cid = [1,2,3,4,5,6,8,9,11,12,13,14,15,16,122,127,275,280,291,293,348,502,651,1055]
for i in cid:
header = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
}
parmas = {
'fid':'831423',
'cid':i,
'r':'1',
}
print(i)
time.sleep(2)
response = requests.get(url,headers=headers,params=parmas)
result = response.text
josn_w = json.loads(result)
x = pd.DataFrame(josn_w,index=[0])
print(josn_w)
filename = r"D:\爬虫\20009\沃特福德vs南安普顿\{}.csv".format(i)
print(filename)
x.to_csv(filename, sep=',', header=True, index=False)
find() |
|