Answer the question
In order to leave comments, you need to log in
Python wget xml?
I'm trying to download an xml file (TV program) wget :
wget.download(" epg.it999.ru/epg2.xml.gz ", "epg.xml")
As a result, I get this mess:
‹ ¬S[sЗ•5ъ|&в‡ 'zhxB‡RWU_g<yuўq%D ҃Ґ "PКltslD0OEYІ'¤П'hЭ†&%Rte& ? ePPzOHџkhyuZO~ьMMttye•Yo°зџцћ]tћE.yug/
How to fix?
Answer the question
In order to leave comments, you need to log in
Because .gz is an archive, so it needs to be unpacked. And yes, the wget library is not very common, it's better to use requests
An example of downloading a file using requests. You can download any.
import requests
url = 'https://www.cs.uky.edu/~keen/115/Haltermanpythonbook.pdf'
r = requests.get(url, stream = True)
with open("PythonBook.pdf", "wb") as Pypdf:
for chunk in r.iter_content(chunk_size = 1024):
if chunk:
Pypdf.write(chunk)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question