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

'test string \n\n'.rstrip('\n')

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