langchain_core.output_parsers.list.droplastn¶

langchain_core.output_parsers.list.droplastn(iter: Iterator[T], n: int) Iterator[T][source]¶

Drop the last n elements of an iterator.

Parameters
  • iter (Iterator[T]) – The iterator to drop elements from.

  • n (int) – The number of elements to drop.

Yields

The elements of the iterator, except the last n elements.

Return type

Iterator[T]