The Opening of the Tokyo Olympic Games is less than 10 days away, I don’t know if you are looking forward to this Olympic Games? After all, the opening of the Games was fraught with obstacles. For us, no matter how other Olympics are, the 2008 Olympics is yyds in our heart.

So today we will take you back to the wonderful 2008 Olympic Games through big data. We use Python to collect the results of the 2008 Olympic Games, hoping to encourage our Chinese Olympians to win better in the Tokyo Olympic Games through the past historical results.

Now the web page on the Internet is strange, so, before scraping must tread on the spot, find the website.

Open the web page: baike.baidu.com/view/16667….

Here are the steps:

#! - * - encoding: utf-8 - * - import requests the import random # to allow access to the target page # targetUrl = "http://baike.baidu.com/view/16667.htm" To access the goal of the HTTPS page # targetUrl = "http://baike.baidu.com/view/16667.htm" # proxy server (the product's official website www.16yun.cn) proxyHost = "t. 16 yun. Cn" ProxyUser = "username" proxyPass = "password" proxyMeta = "http://%(user)s:%(pass)s@%(host)s:%(port)s" % { "host" : proxyHost, "port" : proxyPort, "user" : proxyUser, "pass" : ProxyPass,} # Set HTTP and HTTPS access to all proxies via PROXIES = {" HTTP ": proxyMeta," HTTPS ": {" proxyMeta "} # set IP switch header tunnel = random.randint(1 10000) headers = {" proxy-tunnel ": str(tunnel)} resp = requests.get(targetUrl, proxies=proxies, headers=headers) print resp.status_code print resp.textCopy the code

At the end of the day, the data analysis will be done. About the Olympic Games everyone has their favorite project, you can look at the schedule of the event will not miss it. Finally, I hope the Chinese delegation will have a good performance in this Olympic Games.