fetch_20newsgroups Trigger eoferror (“zip files” eoF error: zip files have an end

1. Download the file 20newsbydate.tar.gz

Click on the link provided to it directly, the speed is rather fast

2. There are files, how can I read Python? Crossing over

File name – 20newsbydate.tar.gz

The description is as follows:
fetch_20newsgroupsThe function places the uploaded file in
C: \ users (your user_name) \ scikit_learn_data \ 20news_home каталог
Put the file you downloaded here
(if not, create one)
Or execute the console, one sentence per sentence, automatically create a folder after execution

from sklearn.datasets import fetch_20newsgroups
news = fetch_20newsgroups(subset="all")

The file downloaded by Python is called 20news-bydate.tar.gz
I downloaded 20newsbydate.tar.gz
So change it to this
(But first you need to look at this, what is the name of your version of Python loaded by your version)

3. Enter the Python installation folder and find the Twenty_NewsGroups.py file


Open it with any text editor
His jobdownload_20newsgroupsJob

The red square is part of the download file and the red square is part of the decompression file
So we just need to comment out the red box and add the file address
Then Ctrl + S as shown in the image:

It could be an error: about indentation or an error caused by press: code after change

cf1c4c13e70803c62dd0b6cdbf88070d

Then all is well.

If you do it like this, you will be told that the download will have to wait a while.

from sklearn.datasets import fetch_20newsgroups
news = fetch_20newsgroups(subset="all")

Leave a Comment