# -*- coding: utf-8 -*-
import requests
import pandas as pd
from lxml import etree
import time
from time import sleep
url = 'http://quote.fx678.com/exchange/WH'
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
response=requests.get(url,headers=headers)
sleep(2)
html=etree.HTML(response.text)
names=html.xpath('//td[1]/a/text()')
prices=html.xpath('//td[2]/text()')
prices_change=html.xpath('//td[3]/span/text()')
price_high=html.xpath('//td[5]/text()')
price_low=html.xpath('//td[6]/text()')
price_yestday=html.xpat
简单爬取fx678得外汇数据
最新推荐文章于 2024-06-18 18:52:30 发布