"Steve Holden" <sholden at holdenweb.com> writes: > def chomp(s): > return s[:-1] That's incorrect. It's more like chop than chomp. Closer would be: def chomp(s): if s[-1]=='\n': return s[:-1] else: return s However, chomp in perl actually changes the string, which can't be done in Python.