aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples
diff options
context:
space:
mode:
authorGravatar Akshay Modi <nareshmodi@google.com>2018-06-18 21:00:34 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-18 21:04:00 -0700
commit6070ae0e148f50dbc8f36e1654f0a3f53b8b067e (patch)
tree165e4c050220180a76512e304b70eee0cd02a2db /tensorflow/examples
parent60b78d6152e6f8d985f3086930ff986c140c36bf (diff)
Merge changes from github.
PiperOrigin-RevId: 201110240
Diffstat (limited to 'tensorflow/examples')
-rw-r--r--tensorflow/examples/learn/iris.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tensorflow/examples/learn/iris.py b/tensorflow/examples/learn/iris.py
index 03e60972aa..86f5204ec3 100644
--- a/tensorflow/examples/learn/iris.py
+++ b/tensorflow/examples/learn/iris.py
@@ -21,7 +21,8 @@ from __future__ import division
from __future__ import print_function
import os
-import urllib
+
+from six.moves.urllib.request import urlretrieve
import tensorflow as tf
@@ -38,9 +39,7 @@ FEATURE_KEYS = ['sepal_length', 'sepal_width', 'petal_length', 'petal_width']
def maybe_download_iris_data(file_name, download_url):
"""Downloads the file and returns the number of data."""
if not os.path.exists(file_name):
- raw = urllib.urlopen(download_url).read()
- with open(file_name, 'w') as f:
- f.write(raw)
+ urlretrieve(download_url, file_name)
# The first line is a comma-separated string. The first one is the number of
# total data in the file.