import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from urllib.request import urlopen
#Reading the text of novel from a website
huck_fin_url = 'http://www.gutenberg.org/files/76/76-0.txt'
df = urlopen(huck_fin_url)
huck_fin_text = df.read()
#print(huck_fin_text)
huck_fin_chapters = huck_fin_text.split('CHAPTER ')[1:]
误差
文件“/users/richxxxxx/documents/readbooks.py”,第19行,in
huck_fin_chapters=huck_fin_text.split('章')[1:]
typeerror:需要一个bytes-like对象,而不是'str'