Dr. Xiao-Le Deng

Python函数【009】——读取网页到文本

2020-11-11 16:40
#Python
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-  
"""
Date: 2019/11/28
Author: Xiao-Le Deng
Email: xiaoledeng@gmail.com
Function: write a list into the file
"""
import urllib.request

def read_html(url):
    html_text = str(urllib.request.urlopen(url).read().decode("utf-8"))
    return html_text

# read_html("")