大家好,作为一名互联网行业的小白,写博客只是为了巩固自己学习的知识,但由于水平有限,博客中难免会有一些错误出现,有不妥之处恳请各位大佬指点一二!
博客主页:链接: https://blog.csdn.net/weixin_52720197?spm=1018.2118.3001.5343
1,导入包,写框架
# 用urllib中导入发送请求的库urlopen
from urllib.request import Request, urlopen
# quote可以使用中文
from urllib.parse import quote
# 得到html
def get_html(url):
pass
# 保存html
def save_html(html):
pass
# 调用代码
def main():
pass
if __name__ == '__main__':
main()
2,找URL
# 调用代码
def main():
url = ''https://tieba.baidu.com/f?kw=%E5%8D%8E%E4%B8%BA&ie=utf-8&pn=0'
html = get_html(url)
# 保存
save_html(html)
3,如何获取html
# 得到html