Reputation: 447
I am interested in loading a file:
url: https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data
I am wondering if there is an option equivalent to !wget which can be used in python to load the file.
Upvotes: 4
Views: 1082
Reputation: 20298
In order to download files, I tend to use the following helper function, which is fully implemented in Julia, does not rely on the availability of external tools, and is therefore entirely portable across systems (it does, however, depend on HTTP.jl
):
import HTTP
function http_download(url, dest)
HTTP.open(:GET, url) do http
open(dest, "w") do file
write(file, http)
end
end
end
http_download("http://www.julialang.org/", "/tmp/index.html")
Upvotes: 3
Reputation: 42244
The equivalent of Python's wget
in Julia is download
To get the file to your disk just run:
download("https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data","./autofile.txt")
Do not use run
for this because you take a risk that your code will not be portable.
Upvotes: 3
Reputation: 4864
If you want to run any shell command, you use run
as described here. If you want to read the file into Julia, then DelimitedFiles
is your friend.
Upvotes: 2