python2写法:
url = "http://i.863jp.com.cn:86/ioms/app/getEmployeeList"
req = urllib.Request(url)
res_data = urllib.urlopen(req)
data = json.loads(res_data.read())
urllib.urlretrieve(img_src, os.path.join(train_dir, user_id+ face_img_fix))
python3写法:
url = "http://i.863jp.com.cn:86/ioms/app/getEmployeeList"
req = urllib.request.Request(url)
res_data = urllib.request.urlopen(req)
data = json.loads(res_data.read())
urllib.request.urlretrieve(img_src, os.path.join(train_dir, user_id+ face_img_fix))
如果python3的urllib后不加request则会报错 'urllib' has no attribute 'urlretrieve'