根据新浪财经数据接口,获取股票、指数、外汇、期货的实时交易数据
import requests from bs4 import BeautifulSoup headers={'User-Agent':'Mazilla/5.0'} link='http://hq.sinajs.cn/list=hf_AUTD' html=requests.get(link,headers=headers) autd=BeautifulSoup(html.text,"lxml") autd=unicode(autd.p.string) autd=autd.split('"')[1] autd=autd.split(',') for i in range(len(autd)): print autd[i]