Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How does Python climb the academic ranking of soft World Universities

Shulou Source: shulou.com Published: 2022-06-01 20:18:22 10月03日 Update

This article mainly explains "how Python climbs the academic rankings of soft world universities". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how Python climbs the academic rankings of soft world universities.

Development environment

Python 3.8

Spyder

Crawling data # crawling soft World University academic ranking import requestsfrom bs4 import BeautifulSoupif _ _ name__ = "_ _ main__": destinationPath = "html Information .txt" allUniv = [] # headers= {'User-Agent':'Mozilla/5.0'} url=' https://www.shanghairanking.cn/rankings/arwu/2020' try: r = requests.get (url=url Timeout=30) r.raise_for_status () r.encoding = 'utf-8' html = r.text except: html = "" # fd = open (destinationPath, "w+") # Note the error is reported here: UnicodeEncodeError:' gbk' codec can't encode character'\ xa9' in position 0: illegal multibyte sequence fd = open (destinationPath, "w+") Encoding='utf-8') fd.writelines (html) fd.close () # print (html) # Note that the print is not complete here under vscode So save the result in the file soup = BeautifulSoup (html, "html.parser") # fillUnivList (soup) # printUnivList (10) print ("{0: {5})

Tags: World university academic school line content name country total score result learning practical deeper information interest reason practical practical easy to operate data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia MariaDB OPPO Reno Linux