diff --git a/tensorflow/python/keras/layers/preprocessing/table_utils.py b/tensorflow/python/keras/layers/preprocessing/table_utils.py index 88e9d95e2ed..f5397da1f3e 100644 --- a/tensorflow/python/keras/layers/preprocessing/table_utils.py +++ b/tensorflow/python/keras/layers/preprocessing/table_utils.py @@ -144,7 +144,7 @@ def get_vocabulary_from_file(vocabulary_path, encoding="utf-8"): vocab = [] with gfile.GFile(vocabulary_path, "r") as reader: while True: - # Get the next line, and break if it is None. + # Get the next line (incl. \n), and break if nothing is left to read. text = reader.readline() if not text: break diff --git a/tensorflow/python/lib/io/file_io.py b/tensorflow/python/lib/io/file_io.py index a1db2fb056c..7c484c825d3 100644 --- a/tensorflow/python/lib/io/file_io.py +++ b/tensorflow/python/lib/io/file_io.py @@ -165,7 +165,7 @@ class FileIO(object): self._read_buf.seek(offset) def readline(self): - r"""Reads the next line from the file. Leaves the '\n' at the end.""" + r"""Reads the next line, keeping \n. At EOF, returns ''.""" self._preread_check() return self._prepare_value(self._read_buf.readline())