XXX的作业一

代码

    
      from bs4 import BeautifulSoup
      import requests
      r = requests.get('http://www.jxufe.edu.cn')
      html = r.text
      soup = BeautifulSoup(html)
      Soup = soup.prettify()
      text = soup.text
      text = text.replace("\n", "")
      with open('html.txt', 'w', encoding='utf-8') as fp:
        fp.write(text)

      print(x)
    
    

结果

结果截图

解释