> > def removecrlf( line): > """Remove \r\n or \n from end of string.""" > if line[-1:] == '\n': > if line[-2:-1] == '\r': > return line[:-2] > else: > return line[:-1] > else: > return line > so on the worst case you create 3 strings to return one. Ick.