#coding:utf-8
import requests,os
from bs4 import BeautifulSoup
from lxml import etree
path=r"C:\Users\caoshuangzhen\Desktop\python2\gupiaoshujuxiazai"
filenames=os.listdir(path)
filenameslist=[]
for i in range(len(filenames)):
filenameslist.append(filenames[i].split(".")[0])
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
n=0
for code in filenameslist:
if n<3:
n+=1
#r = requests.get("http://vip.stock.finance.sina.com.cn/corp/go.php/vMS_FuQuanMarketHistory/stockid/"+code+".phtml?year=2017&jidu=1")
r=requests.get("http://vip.stock.finance.sina.com.cn/corp/go.php/vMS_FuQuanMarketHistory/stockid/600000.phtml?year=2017&jidu=1")
html=r.content
html_doc=html.decode("utf-8","ignore")
print html_doc
"""
url='http://music.baidu.com'
r = requests.get(url)
html=r.content
html_doc=str(html,'utf-8') #html_doc=html.decode("utf-8","ignore")
print(html_doc)"""
import requests,os
from bs4 import BeautifulSoup
from lxml import etree
path=r"C:\Users\caoshuangzhen\Desktop\python2\gupiaoshujuxiazai"
filenames=os.listdir(path)
filenameslist=[]
for i in range(len(filenames)):
filenameslist.append(filenames[i].split(".")[0])
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
n=0
for code in filenameslist:
if n<3:
n+=1
#r = requests.get("http://vip.stock.finance.sina.com.cn/corp/go.php/vMS_FuQuanMarketHistory/stockid/"+code+".phtml?year=2017&jidu=1")
r=requests.get("http://vip.stock.finance.sina.com.cn/corp/go.php/vMS_FuQuanMarketHistory/stockid/600000.phtml?year=2017&jidu=1")
html=r.content
html_doc=html.decode("utf-8","ignore")
print html_doc
"""
url='http://music.baidu.com'
r = requests.get(url)
html=r.content
html_doc=str(html,'utf-8') #html_doc=html.decode("utf-8","ignore")
print(html_doc)"""