Asked • 05/05/19

How can I remove a trailing newline in Python?

What is the Python equivalent of Perl's `chomp` function, which removes the last character of a string if it is a newline?

1 Expert Answer

By:

Mariheida C. answered • 05/06/19

Tutor
5 (94)

SAT/ACT Math, CS, Bilingual Spanish

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.