China A shares analysis system---core subject crawler

Source: Internet
Author: User

Crawl the content of a page first, and then gradually improve.

#Oriental Wealth A core theme crawler system 0.1#python version: 2.7#ImportUrllib2ImportUrllibImportRe#build a reptile class Hexin_spiderclassHexin_spider:def __init__(self):Pass    #SCODE is a stock code, considering whether to use tuples to pass in  defGetPage (self,scode): Myurl="http://f10.eastmoney.com/f10_v2/CoreConception.aspx?code="+Scode myreq=Urllib2. Request (myurl) myresponse=Urllib2.urlopen (myreq) MyPage=myresponse.read () unicodepage= Mypage.decode ("Utf-8") MyItems= Re.findall ('<div class= "Summary" > (. *?) </div>', Unicodepage)#returns the content of the captured core subject matter.     returnMyitems[0]

China A shares analysis system---core subject crawler

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.