I have to say that Python is very easy to get started. On the internet to find a bit, most of Python2 's post, so readily wrote a python3. The code is very simple and does not explain, directly paste the code.
The code is as follows:
#test RDP
Import Urllib.request
Import re
#登录用的帐户信息
data={}
data[' Fromurl ']= '
data[' fromurltemp ']= '
data[' loginId ']= ' 12345 '
data[' password ']= ' 12345 '
User_agent= ' mozilla/4.0 (compatible; MSIE 5.5; Windows NT) '
#登录地址
#url = ' Http://192.168.1.111:8080/loginCheck '
PostData = Urllib.parse.urlencode (data)
PostData = Postdata.encode (' Utf-8 ')
headers = {' User-agent ': user_agent}
#登录
res = Urllib.request.urlopen (url,postdata)
#取得页面html
strresult= (Res.read (). Decode (' Utf-8 '))
#用正则表达式取出所有A标签
p = re.compile (R ' (. *?) ')
For M in P.finditer (strresult):
Print (M.group (1)) #group (1) is the contents of the HREF, group (2) is the text in a tag
About cookies, exceptions and so on processing looked, did not take the time to deal with, after all, just want to write a crawler to learn python.