1 import urllib.request 2 response=urllib.request.urlopen(‘https://movie.douban.com/‘,None,2) 3 html=response.read().decode(‘utf-8‘) 4 f=open(‘html.html‘,‘w‘,encoding=‘utf-8‘) 5 f.write(html) 6 f.close()
原文:https://www.cnblogs.com/larken/p/10586094.html