简体   繁体   中英

file retrieving from url python

I keep getting the error message about syntax error. The file is easily downloadable if I use the url in the browser, but I cannot manage to get the data for learning through jupyter by writing the code. Would be good if somebody could help me to solve this issue. Thank you.

import urllib.request
url = "https://www.cs.cmu.edu/~./enron/enron_mail_20150507.tar.gz"`
urllib.request.urlretrieve(url,
   filename="C:\Users\SnajderovaM\Documents\Training\Udacitynanodegree\Machinelearning\emails\enron_mail_20150507.tar.gz")

urlretrieve is a function defined in the library itself and not under requests

import urllib
urllib.urlretrieve(url, filename)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM