how to remove newline from the end of a string in python code example Example: python removing \n from string line = line.strip('\n') line = line.strip('\t')