import requests
from bs4 import BeautifulSoup
import re
x = requests.get('http://www.jxufe.edu.cn')
html = x.text
f = open('jxufeedu.html','w',encoding='utf-8')
soup = BeautifulSoup(html)
text = soup.get_text()
text = re.sub('\n+', '\n',text)
print(text)
运用requests得到网页代码,获取江财官网源代码并写入text,再用BeautifulSoup获得text内容,导入re模块换行。