# -*- coding: utf-8 -*-
"""
Spyder编辑器
这是一个临时脚本文件.
"""
import csv
file = open("text.csv","a",encoding = "utf-8")
header = ["阅读数",'评论数','标题','作者','时间','网址']
writer = csv.DictWriter(file,header)
#dic = {'阅读数':read[i],'评论数':comments[i],'标题':title[i],'作者':author[i],'时间':date[i],'网址':href[i]}
#csv_writer.writerow(dic)
import urllib.request
url = "https://guba.eastmoney.com/list,600519.html"
resp = urllib.request.urlopen(url)
html = resp.read()
realhtml = html.decode("utf-8")
print(realhtml)
import re
n_read = '\"l1 a1\">(\d*)</span>'
n_comments = '\"l2 a2\">(\d*)</span>'
p_title = '\"l3 a3\"