truncate.py 153 B

123456
  1. import sys
  2. def truncate(str, limit, ellipsis='...'):
  3. return str[:limit] + ellipsis if len(str) > limit else str
  4. sys.modules[__name__] = truncate