Python’s `strip` method returns a string with specified characters removed from its beginning and end. For example, `word.strip("\n")` removes newline characters at the edges without changing characters inside the string. section 23.1
Remove a trailing newline
word = "bird\n" word = word.strip("\n") print(word) # bird The first line stores a word followed by a newline. The second removes that newline from the string’s end, leaving clean data for later processing. section 23.1
word = word.replace("\n", "")
word = word.strip("\n")
Compare `replace("\n", "")` with `strip("\n")` when cleaning a line read from a file. section 23.1



