strip-prefix.py 342 B

12345678910111213141516
  1. import sys
  2. from jaraco.text import Stripper
  3. def strip_prefix():
  4. r"""
  5. Strip any common prefix from stdin.
  6. >>> import io, pytest
  7. >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
  8. >>> strip_prefix()
  9. def
  10. 123
  11. """
  12. sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)