how to remove \n from back of a string code example Example: remove n string a_string = a_string.rstrip("\n")