How can I remove a trailing newline? April 7, 2022 by IT Nursery What is the Python equivalent of Perl’s chomp function, which removes the last character of a string if it is a newline? 2 27