tail

mdtools.file_handler.tail(fname, n, **kwargs)[source]

Read the last n lines from a file.

Parameters:
  • fname (str or bytes or os.PathLike) – Name of the input file.

  • n (int) – The number of lines to read from the end of the input file.

  • kwargs (dict, optional) – Additional keyword arguments to parse to mdtools.file_handler.xopen(). See there for possible arguments and their description. By default, mode is set to 'rt' (open file for reading in text mode).

Returns:

lines (list) – List containing the last n lines of the input file. Each list item represents one line of the file.