how to get rid of \n in python string code example Example: remove n from string python a_string = a_string.rstrip("\n")