What is the Python equivalent of Perl\'s chomp function, which removes the last character of a string if it is a newline?
chomp
workaround solution for special case:
if the newline character is the last character (as is the case with most file inputs), then for any element in the collection you can index as follows:
foobar= foobar[:-1]
to slice out your newline character.