标签:步骤 amp port called bsp 代码 获取 eth das
#代码设计:步骤一:获取网页信息。步骤二:对数据进行帅选。部署三对数据进行打印
import requests
import re
import pandas as pd
def GetHtml(url):
try:
r=requests.get(url)
r.raise_for_status()
r.encoding=r.raise_for_status()
return r.text
except:
return ‘网络异常‘
def Getinfo(list,html):
pattern=re.compile(r‘class="wsod_symbol">(.*?)<\/a> .*?>(.*?)<\/span>.*\n.*?class="wsod_stream">(.*?)<\/span><\/td>‘)
info_text=pattern.findall(html)
for item in info_text:
list.append(item)
return "list"
def InfoList(infolist):
info_text=pd.DataFrame(infolist)
print(info_text)
def main():
infolist=[]
url=‘http://money.cnn.com/data/dow30/‘
html=GetHtml(url)
info=Getinfo(infolist, html)
InfoList(info)
main()
ValueError: DataFrame constructor not properly called! (求大神指教)
标签:步骤 amp port called bsp 代码 获取 eth das
原文地址:https://www.cnblogs.com/baoerdeyidongchengbao/p/12950461.html