def read_txt(filename):
  """Read file to list of lines."""
  examples = []
  with gfile.GFile(filename, "r") as tsv_file:
    for line in tsv_file:
      line = line.rstrip()
      examples.append(line)
  print("Loaded %s lines from %s." % (len(examples), filename))
  return examples
Read file to list of lines.
language/compgen/csl/common/txt_utils.py