8 Answers

Kotope strip() - method on str. (via @metamoof) kotope (0) - 4 years, 6 months ago via Twitter - Add Comment
Mard McKonald "string".rstrip() will remove all whitespace from the end (not just newlines). "str".rstrip('\n') will do just whitespace snuff_man (0) - 4 years, 6 months ago via Twitter - Add Comment
Bruce Hoult .rstrip('\n') brucehoult (0) - 4 years, 6 months ago via Twitter - Add Comment
Phillip str.rstrip("\r\n") will do it sitharus (0) - 4 years, 6 months ago via Twitter - Add Comment
Jack Repenning "chop" is "whatever[:-1]". Been looking for "chomp" myself, no joy jrep (0) - 4 years, 6 months ago via Twitter - Add Comment
saniac strip() i think. Eg " foo ".strip() saniac (0) - 4 years, 6 months ago via Twitter - Add Comment
saniac Actually what @BruceHoult said. saniac (0) - 4 years, 6 months ago via Twitter - Add Comment
Stephen Belcher 'apt-get remove python & perl -e "chomp"' I don't actually know sycobuny (0) - 4 years, 6 months ago via Twitter - Add Comment

Would you like to answer?

Sign in with Twitter to post your answer: