human
remove (chomp) a newline
assistant
Here is some code to remove trailing newline in string "test string\n"

'test string\n'.rstrip()

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.