Any suggestion about how I can avoid type mismatch?

Viewed 24

I read HTML file from the web and I am attempting to parse the texts

>>> import nltk
>>> import urllib3
>>> http = urllib3.PoolManager()
>>> r = http.request('GET', 'http://www.gutenberg.org/files/2554/2554.txt')
>>> r.status
404
>>> tokens = nltk.word_tokenize(r.data)

TypeError: cannot use a string pattern on a bytes-like object

It appears that type mismatch is occurring but I failed to know the solution.

1 Answers
Related