非常感谢https://www.cnblogs.com/xin-xin/p/4297852.html。该系列讲解很详细。
另附上我写的抓取炒股概念代码。
采用火狐浏览器,F12,选取Network,解析一下传送的地址。
import urllib.request import re import requests # def main(): # # url = "http://www.iwencai.com/school/dictionary?qs=study_dictonary_stock" # # url='http://www.iwencai.com/yike/article-class-list?tagId=37' # url="http://www.iwencai.com/yike/detail/auid/716981f756614a79" # try: # data = urllib.request.urlopen(url).read() # content = data.decode('UTF-8') # # # pattern = re.compile('<div class="term_top clearfix">.*?<a.*?point_info="title">(.*?)</a></div>.*?' #