Skip to content Skip to sidebar Skip to footer

Working With Python, Files

I have some data files which I need to read. I know I should use Dataset, but is there a way how to download these files without downloading them manually but by its URL? How would

Solution 1:

Maybe save the contents to a temporary file?

import urllib.request

response = urllib.request.urlopen(url)

with open("./tempfile", "w") as f:
    f.write(response.read())

Now the file ./tempfile can be used normally


Post a Comment for "Working With Python, Files"